1

Using Text Filter I have filtered the List, now I need to count how many records have been filtered. Is it is feasible in SharePoint out of box feature?

For example: In Text Filter if I type "Oracle" where ever the word Oracle is present in the list it displays all the rows, Now I need to know the count of the word Oracle present in that list.

  • You can create a calculated column and find the occurance of the word Oracle in the item and find the count. – userAZLogicApps Dec 30 '15 at 5:34
  • Ok, let me try and let you know. – Bagavathi Dec 30 '15 at 5:35
  • you can look at this link for the first approach : stackoverflow.com/questions/978057/… – userAZLogicApps Dec 30 '15 at 5:55
  • In your list view, couldn't you just put a total on the Title field and then it should give you the count of matching items. – Eric Alexander Dec 30 '15 at 13:58
1

Another approach is to use SPServices library to access the list items through the JavaScript and jQuery and find the word Oracle in the item and declare a variable count, increase this variable whenever you find this variable and find the sum.

Add SPServices code inside a Content Editor Web Part and hide this web part. Download the SPServices library, jQuery library.

Below is just a sample code,and its incomplete, you can further google it out to get the remaining.

     <script language="javascript" 
     src="/ursitecollec1/AssetLibrary1/jquery-1.6.0.min.js" 
      type="text/javascript"></script>
       <script language="javascript" 
         src="/ursitecollec1/AssetLibrary1/jquery.SPServices-
        2014.01.min.js" type="text/javascript">
       <script language="javascript" type="text/javascript">

    $(document).ready(function() {
    $().SPServices({    
   operation: "GetListItems",  
   async: false,  
            listName: "YourSPListName",
            CAMLQuery: "<Query><Where><IsNotNull><FieldRef Name='Title'/>
         </IsNotNull></Where></Query>",
            CAMLViewFields: "<ViewFields><FieldRef Name='Title' />
     <FieldRef Name='yourOraclewordListColumnName' /></ViewFields>",  
CAMLRowLimit: 0,
completefunc: function (xData, Status) 
            {  
                     //alert(' inside completfunc xdata.responsexml is 
         .....'+ xData.responseXML); 
       //var itemCount =   
         $(xData.responseXML).SPFilterNode("z:row").attr("ItemCount");  
      //alert("itemCount :" + "" + itemCount);
       var count = 0;  
  //$(xData.responseXML).find("[nodeName='z:row']").each(function()   
              $(xData.responseXML).SPFilterNode("z:row").each(function()   
  {  
    count = count + 1;   

                            //console.log(' current count is ..'+ count);
                                   //alert(xData.responseText);
     //alert(xData.responseXML.xml);
       var titleofresourcelist =  $(this).attr("ows_Title");
    var titleofresourcelist =  
     $(this).attr("ows_yourOraclewordListColumnName");
  • ok, thanks for sharing, let me try this and let you know. – Bagavathi Dec 30 '15 at 5:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.