How to get Result Count Content By Search Webpart (ContentBySearchWebPart)?

I'm writing a webpart that extends the out of the box ContentBySearchWebPart.
Does any one know how to get the search result count from this webpart?
I did not find any property?

Hi 
Thanks but you are referring to the "Search Webpart". I am referring to the "Content Search" or often called "Content by Search" which is different. It's the one under Content Rollup.
Although very similar they're not - Content Search WP doesn't have that property.
What I am really after is to hide the whole webpart if there are no results coming back. I tried to figure it out and even write a jQuery that would search for the text "There are no results" message which comes from the webpart when result count=0
and hide the parent webpart that way. There will be a short flash once the page loads rendering the webpart for a split second and then disappear by jQuery - which is not great UI experience.
There is this property: "ShouldHideControlWhenEmpty" but it doesn't do anything when there are no results. The webpart is still visible. Webpart has a the Title and the Border around it so when there are no results the title and the border show
up with no results. Like I said I want to hide the whole thing in that case.
So I thought I could extend the OOTB ContentBySearchWebPart and get a hold of some kind property that would get me the result count. If the results count is 0 simply I would hide the webpart server side.
Thoughts?

Similar Messages

  • How to get attendies count for a calendar list in sharepoint 2013?

    Hi everybody,
    I am using calendar list in SharePoint 2013 for my project.
    Could please tell me how to get the count of attendees using SP Designer or OOTB calculated field.
    Because I want to display the fields like
    TOTAL SEATS =20
    Attendees= Need count
    Avail seats= total - Attendees count.
    In that way I want to show information about availability seats for training session.
    Regards,
    Dhayanand

    Hi Dhaya
    Please refer the links.Hope it helps :-)
    http://social.msdn.microsoft.com/Forums/en-US/b8677dc5-3eb1-4bdc-92f2-f57201bfabb1/field-that-counts-attendees?forum=sharepointcustomizationprevious
    http://sharepoint.stackexchange.com/questions/54253/use-count-related-column-value-as-int-in-a-sp-designer-workflow

  • Multi Mapping : How to get Message count after splitting

    Hi all,
    I am following below blog.
    /people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi
    Can any body please tell me how to get the count of messages generated after splitting in the message mapping.. I have created the message data type but not aware what is needed to be done.
    Thanks and best regards,
    Kulwant Singh

    Multi mappings r done in order to split the messages to the number of messages required by the user. So for 1:N mapping, the details about "N" is based on ur requirement. So its not like - when u split, any number of message could get created. The count would be dependent on u.
    Regards,
    Prateek

  • How to get(copy) the contents i.e the cell of an excel sheet to other excel

    How to get(copy) the contents i.e the cells of an excel sheet to another excel sheet.
    I can read the contents i.e the text in the cells and able to display it in the Java console
    i want these contents to be copied to another excel sheet with the cells data.
    I am using Java Swing for the UI, POI framework for the excel work.
    Please anyone suggest some code to this requirement.

    [spreadsheets with poi|http://poi.apache.org/spreadsheet/converting.html] Hi
    on the poi apache site there's a number of good examples...
    I started with poi only a week ago, but just from reading these examples
    (especially SS Usermodel code) i managed all i needed to know (so far).
    kind regards
    BB
    Edited by: BugBunny on Feb 22, 2010 4:36 AM

  • How to get file count in variable?

    dear all,
    how to get file count in variable?
    regards
    Naseer

    Hi Nazeer ,
    It wont take much time .. so simple :- )
    Create one os comand step
    ( for unix) Use
    wc -l filename.txt > someoutputfile.txt
    Now the number of lines in your file will be there in the output file ( someoutputfile.txt )
    Step2 :-
    Now use Cezar's logic to fetch the variable value ( file count ) from the output file .. ( select value for a variable from a file )
    This will not take eeven a second to finish the job.
    Regards,
    Rathish A M

  • How to get Page Count of pdf in Document library in EventHandler

    Hi,
    How to get Page Count of pdf in Document library once uploaded has been done and i would like to update the page count value in document library column of the corresponding file.
    I should achieve it in Event handler.
    Which even should i use, either ItemAdded or "ItemUpdated "?
    Thanks & Regards
    Poomani Sankaran.

    Hello,
    If you are looking for file download or view count then event handler will not work. You need to enable the analytic report to your site. Once you enable it then you can see the report within a browser or you can also create custom webpart to show count
    of specific file.
    http://blogs.msdn.com/b/ecm/archive/2010/05/03/web-analytics-in-sharepoint-2010-insights-into-reports-and-metrics.aspx
    http://sharepoint.stackexchange.com/questions/34611/count-of-files-under-a-folder-in-a-document-library
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How do get rid of the google search box when I first open Firefox?

    How do get rid of the google search box when I first open Firefox?

    Firefox 4 and later versions use a new build-in home page named <b>about:home</b> with a Google search bar on it.
    That about:home page only shows some snippets and has a button to restore the previous session if applicable.
    If you want a home page with extras then set another page as the home page like www.google.com as used in Firefox 3 versions.
    *https://support.mozilla.com/kb/How+to+set+the+home+page
    See also:
    *Tools > Options > General > Startup: "When Firefox Starts": "Show my home page" "Show a blank page"

  • How about get item count of table in formGroup.vm

    JHeadstart Team:
    I want change maxColumns=" 1" or" 2" by item count of table .but I do not know how about get item count of table .
    #if (${JHS.current.group.columns} > 10)
    #set ($majin = 2)
    #else
    #set ($majin = 1)
    #end
    <af:panelForm rows="1" maxColumns="$majin" width="${JHS.current.group.formWidth}" id="${JHS.current.group.shortName}FormItems">
    majin
    #FORM_ITEMS()
    </af:panelForm>

    You can do this using the following syntax:
    #if (${JHS.current.itemContainer.items.size()}>10)
    maxColumns="2"
    #else
    maxColumns="1"
    #end
    Steven Davelaar,
    Jheadstart Team

  • How to get result of querry independet of a datatype?

    Hi All!
    I try to write a program, that calls stored procedures in a database independent of a name and arguments list. To get a result of a query I must call one of the functions getInt(), getString() etc. of CallableStatement. I'd like to write a wrap function, for instance getResult(), that get the result independent of the result's type. Has anybody any idea, how I can do it?
    Any help will be appreciate.
    Regards,
    Andrej.

    Hi Justin,
    Even we have been writing a kind of these generic methods to send a query to database, fetch the Resultset and then populate an ArrayList with the Resultset data.
    What do you get out of this ?
    -> Less code to maintain
    -> Single point of access to datasource
    -> JDBC Code reuse
    i agree that it might cost some cpu cycles in populating an ArrayList and then doing the casting again. But isn't it worth all the above credits.
    An example of such a method is
      public ArrayList execute( String query, ArrayList params )
                    throws SQLException {
        Connection con = null; // Database Connection object
        ArrayList rowset = new ArrayList();
        try {
          // Get the Database Connection
          con = connector.getConnection();
          // Use PreparedStatement object to execute the SQL Query
          PreparedStatement pst = con.prepareStatement( query );
          // Bind the columns values from the ArrayList object
          if( params != null ) {
            for( int i = 0; i < params.size(); i++ ) {
              pst.setObject( i + 1, params.get( i ) );
          // Execute the Query to get the ResultSet object
          ResultSet rst = pst.executeQuery();
          // Get column count from ResultSet Metadata
          int colCount = rsmtdt.getColumnCount();  // This may not be the correct syntax
          // Populate ArrayList
          while(rset.next()) {
            ArrayList row = new ArrayList();
         for(int i=1;i<=colCount;i++)
           row.add(rset.getObject(i);
         rowset.add(row);
          // Close the ResultSet and Statement
          rst.close();
          pst.close();
        } catch( SQLException ex ) {
          throw new DBException( "Unable to execute the SQL Query in execute "+
                                     "method of DBBroker class of given status " +
                                 " : " + ex.getMessage() );
        } catch( Exception ex ) {
          throw new DBException( "Exception thrown in execute() method of " +
                                 "DBBroker class of given status : " +
                                  ex.getMessage() );
        } finally {
          try {
            connector.releaseConnection( con ); // Releases the connection
          } catch( DBConException ex ) {
            throw new DBException( "Unable to release the connection of given " +
                                   "status : " + ex.getMessage() );
        return rowset;
      }Regards
    Elango.

  • How to get a count of unique records

    How do you get a count of unique records? Looking only for one number, not a list..so if the data is:
    ID
    ===
    1234
    1234
    1234
    1236
    1236
    1237
    Then, the count total will be one field called 'ID' with the value '3' in it..
    All I know how to do is get a count that will count all records, or do it in two queries. Looking to do this in one query statment..
    Thanks..

    Just a small clarification...
    Concatenation could potentially give wrong result, depending on the data.
    For example...
    sudhakar@ORCL>ed
    Wrote file afiedt.buf
      1  with t1 as
      2  (select 'AA' c1, '101' c2 from dual union
      3  select 'AA1' c1, '01' c2 from dual union
      4  select 'AA101' c1, null c2 from dual union
      5  select 'BB2' c1, '345' c2 from dual union
      6  select 'AA101' c1, null c2 from dual union
      7  select 'BB2' c1, '345' c2 from dual union
      8  select 'BB234' c1, '5' c2 from dual
      9  )
    10* select count(distinct c1 || c2) from t1
    sudhakar@ORCL>/
                        2IMHO, the required answer will be...
    sudhakar@ORCL>ed
    Wrote file afiedt.buf
      1  with t1 as
      2  (select 'AA' c1, '101' c2 from dual union
      3  select 'AA1' c1, '01' c2 from dual union
      4  select 'AA101' c1, null c2 from dual union
      5  select 'BB2' c1, '345' c2 from dual union
      6  select 'AA101' c1, null c2 from dual union
      7  select 'BB2' c1, '345' c2 from dual union
      8  select 'BB234' c1, '5' c2 from dual
      9  )
    10* select count(distinct c1 ||'.'|| c2) from t1
    sudhakar@ORCL>/
                             5
    sudhakar@ORCL>vr,
    Sudhakar B.

  • How to get all Conditions in Advanced Search

    Hi All,
    I'm implementing the AdvancedSearch using Query bean.
    I have defined the Criteria row with one Item of Varchar2 Datatype.
    On Advance Search the poplist shows only two conditions (Lookup type=ICX_CONDITIONS) of "is" and "is not". How to get the complete list of conditions ("contains", "ends with", "starts with"....)
    Thanks,
    Satya

    What is the item type for which you get only the two conditions.
    If the item type is OAMessageChoiceBean or OAMessageLovInputBean the conditon poplist will contain only those two options. And if the datatype is Boolean the conditon poplist will again contain only those two options.

  • How to get the count of repeating elements in a xml doc.

    In many xml documents, in is common to have repeating child elements and what I would like to know is how do I determine exactly how many of these child elements exist in a particular document. There is probably a correct XPath string to determine this, but I cannot figure out what it is. Here is an example
    <a>
    <b>
    <c>1</c>
    <c>5</c>
    <c>22</c>
    </b>
    </a>
    The above 'c' element is what varies in number from document to document and I need to know how to get the number of 'c' elements for the document, which would be 3 in the above case.

    create table test_xml(data xmltype)
    insert into test_xml values(
    xmltype('<a>
    <b>
    <c>1</c>
    <c>5</c>
    <c>22</c>
    </b>
    </a>')
    select extract(data, '/a/b/c').getclobval() from test_xml
    select count(*) from test_xml
    where existsnode(data, '/a/b/c')=1
    good luck.

  • Select Count(*) from Sample_table - how to get the count using JDBC?

    Hi All,
    It would be glad if anyone could help me with this. The problem is that I have to get the 'count' of records selected from a arbitrary table say, 'sample_table'. Is that possible to form the SQL in JDBC as
    Select Count(*) from Sample_table
    and get the value of the count? If yes, how?
    Thanks in advance
    Prabz

    stmt = con.createStatement();
    ResultSet recordcnt_rs = stmt.executeQuery("Select Count (*) as record_ctr From Sample_table");
    recordcnt_rs.next();     
    record_ctr = recordcnt_rs.getInt("record_ctr");
    hope this helps.

  • How to get the count of each minutes

    Oracle 10 DB
    Hi All
    I using this query to get the count of records fetched by the concurrent program per min,
    select count (distinct b.attribute2)
    from oe_order_headers_all a,oe_order_lines_all b
    where a.header_id=b.header_id
    and b.flow_status_code ='AWAIT_QUINTIQ_BOOK'
    and to_Char(b.last_update_date,'DD-MON-YYYY HH24:MI:SS') between '19-JAN-2011 02:00:01' AND
    '19-JAN-2011 02:00:02'
    This is used to get the count of records fetched at one mins
    How to find the count of last 10 mins ie 1 mins count 2.00 to 2.10
    Thanks & Regards
    Srikkanth.M

    Try this:
    SELECT TRUNC(b.last_update_date, 'mi') time_mins, COUNT(DISTINCT b.attribute2)
    FROM   oe_order_headers_all a,
           oe_order_lines_all b
    WHERE  a.header_id = b.header_id
    AND    b.flow_status_code = 'AWAIT_QUINTIQ_BOOK'
    AND    b.last_update_date >= to_date('19/01/2011 02:00:00', 'dd/mm/yyyy hh24:mi:ss')
    AND    b.last_update_date < to_date('19/01/2011 02:10:00', 'dd/mm/yyyy hh24:mi:ss')
    GROUP BY TRUNC(b.last_update_date, 'mi');I'm not sure why you're bothering with the join to the oe_order_headers_all table, since you're not referencing that in the where clause or the selected columns list. I think you could probably do away with it.
    I've changed your code to take the last_update_date and truncate it to the minute level, and added that as a column, so you can see which count goes with which minute. Obviously, this has to be in the group by.
    I've also changed your date comparisons so that you're actually comparing dates to dates, rather than strings to strings - why would you deliberately take information away from the optimizer? Oracle does not treat strings the same as dates, and forcing it to use strings rather than dates could lead you to have a vastly differing execution path, which will most likely be less performant.
    Not to mention, coding like that leads you to assume that you can compare dates in strings without any problems, and that is just not the case. '19-FEB-2011' is counted as being earlier than '19-JAN-2008', as strings sort alphabetically.

  • How to get the count of PO'S raised by a user

    Hi,
    I have a new requirement whr i am asked to get the count of number of PO'S raised by a particular user in report. Suppose the user raised 10 purchase orders .
    The requirement is when a user name is given it has to give count of 10.
    Where shud i include this,in rows or columns. Please suggest.
    Thanks&Regards,
    Praveen

    Hi Praveen,
    take a look in www.service.sap.com/bi, under old release, for release 2.x you will find an How to that detail how to count occurencies of a Char. Maybe you will find here the solution.
    Ciao.
    Riccardo.

Maybe you are looking for