Creation of quick alphabetical ladder in SharePoint

Output result:
We will be getting a filtered data like below, filtered on top of title starting with alphabet.
SharePoint View

OOB SharePoint View

Creation Process:

Step 1) Create a calculated column named <<Initial>> in the list having below formula:

=IF(OR(LEFT(Title)<”a”,LEFT(Title)>”z”),”other”,LEFT(Title))

Above formula, will extract initial letter from the title text.

SharePoint Filtered View

SharePoint Filtered View

Step 2) Create a ladder to show:

<table cellpadding=4 cellspacing=0>
<tr>
   <td><a href=”#” onClick=”showAll(); return false;”>All</a></td>
   <td><a href=”#” onClick=”setFilter(‘a’); return false;”>A</a></td>
   <td><a href=”#” onClick=”setFilter(‘b’); return false;”>B</a></td>
   <td><a href=”#” onClick=”setFilter(‘c’); return false;”>C</a></td>
   <td><a href=”#” onClick=”setFilter(‘d’); return false;”>D</a></td>
   <td><a href=”#” onClick=”setFilter(‘e’); return false;”>E</a></td>
   <td><a href=”#” onClick=”setFilter(‘f’); return false;”>F</a></td>
   <td><a href=”#” onClick=”setFilter(‘g’); return false;”>G</a></td>
   <td><a href=”#” onClick=”setFilter(‘h’); return false;”>H</a></td>
   <td><a href=”#” onClick=”setFilter(‘i’); return false;”>I</a></td>
   <td><a href=”#” onClick=”setFilter(‘j’); return false;”>J</a></td>
   <td><a href=”#” onClick=”setFilter(‘k’); return false;”>K</a></td>
   <td><a href=”#” onClick=”setFilter(‘l’); return false;”>L</a></td>
   <td><a href=”#” onClick=”setFilter(‘m’); return false;”>M</a></td>
   <td><a href=”#” onClick=”setFilter(‘n’); return false;”>N</a></td>
   <td><a href=”#” onClick=”setFilter(‘o’); return false;”>O</a></td>
   <td><a href=”#” onClick=”setFilter(‘p’); return false;”>P</a></td>
   <td><a href=”#” onClick=”setFilter(‘q’); return false;”>Q</a></td>
   <td><a href=”#” onClick=”setFilter(‘r’); return false;”>R</a></td>
   <td><a href=”#” onClick=”setFilter(‘s’); return false;”>S</a></td>
   <td><a href=”#” onClick=”setFilter(‘t’); return false;”>T</a></td>
   <td><a href=”#” onClick=”setFilter(‘u’); return false;”>U</a></td>
   <td><a href=”#” onClick=”setFilter(‘v’); return false;”>V</a></td>
   <td><a href=”#” onClick=”setFilter(‘w’); return false;”>W</a></td>
   <td><a href=”#” onClick=”setFilter(‘x’); return false;”>X</a></td>
   <td><a href=”#” onClick=”setFilter(‘y’); return false;”>Y</a></td>
   <td><a href=”#” onClick=”setFilter(‘z’); return false;”>Z</a></td>
   <td><a href=”#” onClick=”setFilter(‘other’); return false;”>Other</a></td>
 </tr>
</table>

Step 3) Add below simple JavaScript snippet, It will filter on click of letters:

<script language=”javascript”>
var strUrl = location.href;
var strFilterField = ”Initial”;
 function showAll()
 {
       if(strUrl.indexOf(“?”) > -1)
   {
     strUrl = strUrl.split(“?”)[0];
   }
   location.href = strUrl;
 }
 function setFilter(strValue)
 {
   if(strUrl.indexOf(“?”) > -1)
   {
     strUrl = strUrl.split(“?”)[0];
   }
   location.href = strUrl + ”?FilterField1=” +  strFilterField + ”&FilterValue1=” + strValue;
 }
</script>
Step 4) Finally, On click on alphabets data will be displayed:
Final Result in SharePoint View

Final Result in SharePoint View

Cheers :) Happy Coding \m/

Rupesh Singh

Use below source code to insert JQuery and SP Services from developer console:

Step 1) Open developers console tool from any browser and enter below scripts to register JQuery and SP Services.

var jq1 = document.createElement(‘script’);
jq1.src = “//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js”;
document.getElementsByTagName(‘head’)[0].appendChild(jq1);
 var jq2 = document.createElement(‘script’);
jq2.src = “//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.01/jquery.SPServices.min.js”;
document.getElementsByTagName(‘head’)[0].appendChild(jq2);

Step 2) Now, It will appear in page source:

 

Developer Console Toolbar

Developer Console Toolbar

Step 3) Now, you can use SPServices easily from developer console.

Use SP Services from console tool

Use SP Services from console tool

Enjoy Debugging :)

Cheers,

Rupesh Singh

 

Cannot read or write to SharePoint

Recently we were working at a client location and added a new search server to the farm. No issues there. Server was added to the farm over the weekend.

Come Monday morning, we start seeing that all of a sudden people cannot add or edit any data within SharePoint. We also found out that there was only one database in question, hosting a single site collection about 70 GB in size that was running in to issues.

When this generally happens we normally look at the database side to see if things are well. Most of the time the SQL Server is running out of disk space or the database is in read only mode, thereby not allowing users to add or edit data.

However, interestingly enough not the case this time. Nothing in the SharePoint logs either on why this wasn’t working properly. After scratching the heads for a while, we went back looking in to the database server and looked at the specific database that was causing issues. It seems that the database in concern was running in “SQL 2000 Compatibility” mode as opposed to running in “SQL 2005 Compatibility” mode.

As soon as we flipped it back to the SQL 2005 Compatibility mode, things started working properly.

Something new to know, right :)

Cheers,

Nilesh