Highlighted
Contributor.. Contributor..
Contributor..
141 views

Pagination with search results using .NET SDK (Content Manager 9.3)

Jump to solution

I have a custom web application that uses the .NET SDK to query records and then paginates the results. This has worked fine using the .NET SDK with TRIM v8.3..

But using the same code with Content Manager v9.3, I only get 10 results back. The FastCount, Count, etc. all return only 10 instead of the actual total query.

Example: Say I query certain records and the query results should return a total of 850 records using Count. I then take that and populate a paginated page of 10 records per page. However, using the following code, I only get the first 10 records back. Count, FastCount are only 10 instead of 850. So the pagination fails since I am not getting back the actual total number of records.

Code is as follows:

TrimMainObjectSearch objSearch = new TrimMainObjectSearch(db, BaseObjectTypes.Record);
objSearch.SetSearchString(queryString);
objSearch.SetFilterString("type:\"closed case files\"");
objSearch.AddSortItemAscending(SearchClauseIds.RecordNumberx);
objSearch.LimitOnRowsReturned = 10;
objSearch.PagingMode = true;

int totalCount = (int)objSearch.FastCount;  //This should be 850 records

 

The problem is that objSearch.FastCount should be 850 records, but simply matches what the LimitOnRowsReturned is set to.

Has something in 9.3 SDK changed in order to get the query to work the way it did in 8.3?

The strange this is that the FastCount works with the Audit logs (History object), but not the Record and Location objects.

Thanks.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Pagination with search results using .NET SDK (Content Manager 9.3)

Jump to solution

There were major changes between those versions regarding pagination - try calling count right after setting your filter instead.

View solution in original post

0 Likes
6 Replies
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Pagination with search results using .NET SDK (Content Manager 9.3)

Jump to solution

There were major changes between those versions regarding pagination - try calling count right after setting your filter instead.

View solution in original post

0 Likes
Highlighted
Contributor.. Contributor..
Contributor..

Re: Pagination with search results using .NET SDK (Content Manager 9.3)

Jump to solution

OK I will give a try.

Could you briefly describe some of the major changes between the versions?

Thanks!

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Pagination with search results using .NET SDK (Content Manager 9.3)

Jump to solution

Check out https://content-manager-sdk.github.io/Community/93/class_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k_1_1_trim_main_object_search.html

There are quite a few more count related properties, including VeryFastCount, MinimumCount, CountString etc.

There is also a boolean PagingMode that you will probably want to set to true.

Around the same time the web client changed from paging to infinite scroll and a lot of these changes were oriented around that, it might be worth considering changing your application to infinite scroll.

0 Likes
Highlighted
Contributor.. Contributor..
Contributor..

Re: Pagination with search results using .NET SDK (Content Manager 9.3)

Jump to solution

We have PagingMode set to true currently in our app. We have our own custom Pager class we use to paginate the results (10 per page).

For the Infinite scroll, is this something you can set in the SDK, if so how?

Does that also mean we set PagingMode = false?

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Pagination with search results using .NET SDK (Content Manager 9.3)

Jump to solution

With infinite scroll you just keep track of the index or uri of the last item the user has seen and pass that back in to subsequent requests as either SkipCount or SkipToUri

The advantage is that you don't need to call a count function to determine when to stop - instead, once the TrimMainObjectSearch enumerator stops returning values you signal that the client should stop scrolling

0 Likes
Highlighted
Contributor.. Contributor..
Contributor..

Re: Pagination with search results using .NET SDK (Content Manager 9.3)

Jump to solution
This worked when I moved the code up further. However, not sure why that matters. Is there a bug in the system?
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.