Forum Discussion

bhupen's avatar
bhupen
Advisor
10 years ago

How to show result after 1000 records. Its showing blank after 1000 records

Not showing result after 1000 records and showing empty result after 1000 records

Page call get only 1000 records. once record will go up it will get blank result to you.
There is 2 ways yo solve this but Iam not able to get the result for this.

1. write this query in API-V2
    <#assign nots = restadmin( '/users/id/' + user.id + '/notifications?restapi.response_style=view&page_size=' + page + '&page=' + y).notifications />
    
2. Write pagination for this. Following is the pagination I have implemented but it doesn't works for me.
    <#list 1..3 as y>
    <#assign page = notificationsPage * pageSize />
    <#assign nots = restadmin( '/users/id/' + user.id + '/notifications?restapi.response_style=view&page_size=' + page + '&page=' + y).notifications />
    </#list>
   

  • Hi Gyz, I gota fix for that. It might not be upto standard but it fixed my issue. Following is the snippet which shows only used notification instead of unused notification. Once it will go up 1000+ it will assign allnotification to 999. It works perfectely for me.

     

    <#assign _notificationsCount = restadmin( '/users/id/' + user.id + '/notifications/count' ).value?number />
                    <#if ( _notificationsCount > 999 )>    
                    <#assign _notificationsCount = 999 />
                    </#if>

     

    Note: Solution as per my requriement.

  • Hi Gyz, I gota fix for that. It might not be upto standard but it fixed my issue. Following is the snippet which shows only used notification instead of unused notification. Once it will go up 1000+ it will assign allnotification to 999. It works perfectely for me.

     

    <#assign _notificationsCount = restadmin( '/users/id/' + user.id + '/notifications/count' ).value?number />
                    <#if ( _notificationsCount > 999 )>    
                    <#assign _notificationsCount = 999 />
                    </#if>

     

    Note: Solution as per my requriement.

  • PaoloT's avatar
    PaoloT
    Lithium Alumni (Retired)

    Hi bhupen 

     

    I think you can increase these limits via a Support request. However the limits themselves are there for performance reasons, and therefore the question it's more whether you are using the right approach for the problem being solved. The pagination parameters are there exactly for this reasons (rather than pulling a very large quantity of data in one call).

     

    When you say that "it doesn't work" , what specifically is the problem you are running into? Is it an error, or the data being returned is not what you expect etc.. ?

     

    Thanks

    • bhupen's avatar
      bhupen
      Advisor

      PaoloTThanks,  my first preference is to solve this using APIV2.

       

      How to write following rest call with APIV2

       <#assign nots = restadmin( '/users/id/' + user.id + '/notifications?restapi.response_style=view&page_size=' + page + '&page=' + y).notifications />

       

      Second option: is to put into pagination. Following is the code where i put pagination but its  not working and nor showing any error.:

       <#list 1..3 as y>
          <#assign page = notificationsPage * pageSize />
          <#assign nots = restadmin( '/users/id/' + user.id + '/notifications?restapi.response_style=view&page_size=' + page + '&page=' + y).notifications />
          </#list>

       

       

      Red color text defined for pagination functionality.

      Help is appreciated.

      • PaoloT's avatar
        PaoloT
        Lithium Alumni (Retired)

        Hi bhupen 

         

        I don't think notifications are currently part of LiQL - so it is not possible to use API v2 to retrieve this information. If they were, you would probably use the LIMIT and OFFSET keywords to paginate (as for any LiQL query)

         

        Thanks,