Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Web Services

Reply
New Contributor
Posts: 4
Registered: ‎03-23-2012
My Device: none
My Carrier: none
Accepted Solution

pageSize meaning in user search request

What is the meaning of pageSize attribute when doing user search request?

I could not find any description of its meaning in documentation.

With prior versions of BAS, I was able to pull all users with such a request in

Java, but now they are limited to some 500 users/accounts only.

 

I am now dealing with the following environment:

-BES 5.0.3 MR6 (5.0.3.31)

-running on Win 2003 SP2 (Windows/2003 5.2 Intel) on Domino Release 8.5.2FP2 HF148.

-DB SQL Server instances on 64 bit SQL 2008R2 (10.50.2500.0)

 

Here is the Java code that worked in the past and now is misbehaving:

 

GetUsersRequest request = newGetUsersRequest();

request.setMetadata(_meta);

 

GetUsersSearchCriteria searchCriteria =newGetUsersSearchCriteria();

 searchCriteria.setEmailAddress("@");

 

request.setSearchCriteria(searchCriteria);

request.setPageSize(500);

 

GetUsersSortBy sortBy =newGetUsersSortBy();

 

sortBy.setDISPLAYNAME(true);

sortBy.setValue("DISPLAY_NAME");

request.setSortBy(sortBy);

request.setSortAscending(true);

 

GetUsersResponse response =_bws.getUsers(request);

 

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: pageSize meaning in user search request

pageSize refers to the number of results to return at once. This way the BAS can send results in chunks. For efficiency you likely want to keep this between 200-500. The sample code for BWS#getUsers() shows how this is used. One big chunk can be error prone and slow, sometimes even unnescessary depending on how much info you need to display.

 

Cheers,

Garett
@garettBeuk
--
Goodbye everybody!
New Contributor
Posts: 4
Registered: ‎03-23-2012
My Device: none
My Carrier: none

Re: pageSize meaning in user search request

thank you for the reply.

the question now is how do I process page after page until all results are actually grabbed. this would be viable alternative to setting the pageSize to a very large, all-encompassing number to get all results (found records?) in one 'page'.  sample code, perhaps, or a reference to documentation?

second question: if I wanted to do the latter, what number should I set the pageSize to? would, for example, setting it to 0 return result in all records being pulled/returned?

these are the kind of questions that well written BES API documentation would/should solve...

thanks again for all the input!

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: pageSize meaning in user search request

For your first question I would refer you again to  BWS#getUsers() in the API documentation which shows how to retrieve all pages of results.

 

It is not recommended to try to retrieve all results at once for efficiency sake. For example: say you are receiving 10,000 results from the BAS and a failure occurs with the data transmission, you would then need to re-request all 10,000 records. Instead, splitting these up to 200-500 results per page means that if a failure occurs you only need to re-request 200-500 records. 

 

As well, limiting the page request allows you to display information to the user much faster.

Garett
@garettBeuk
--
Goodbye everybody!
New Contributor
Posts: 4
Registered: ‎03-23-2012
My Device: none
My Carrier: none

Re: pageSize meaning in user search request

regrettably I can't find the information that I am being referred to for the 2nd time. would it not be more productive and user friendly, if link to such information be provided here? I have been hunting the docs for the info and was unable to do so. that is why I came to this and other support locations to actually receive help.

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: pageSize meaning in user search request

Sorry, it's in the API documentation located in the standard BWS documentation section:

http://docs.blackberry.com/en/developers/subcategories/?userType=21&category=BlackBerry+Web+Services...

 

If you still have difficulties finding the referenced call please let me know.

Garett
@garettBeuk
--
Goodbye everybody!
New Contributor
Posts: 4
Registered: ‎03-23-2012
My Device: none
My Carrier: none

Re: pageSize meaning in user search request

no problem, it can get frustrating now and then

 

I am unable to find the info still for both most recent questions:

 

1. if I set the pageSize for 200-500 records, what is the API call to get the next page (i.e. ?getNextPage?) of search results for processing and what is the API flag that says that there is no more pages to process (i.e. ?isLastPage?)? this would be my preferred approach, but I can't find in the docs description of such APIs (even if starting from pageSize), as well as examples that use them.

 

2. in my case, retrieving all the results in 'one shot' does not create performance problems, as it is done

only once, at a setup time, and at that time there is no need to display search results to any users. is there a way to setup pageSize to mean 'all records available no matter how many records there may be now or in the future'? or do I need to just provide an estimated number, as parameter, and then revisit the code when such threshold is reached?

 

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: pageSize meaning in user search request

For #1 you pass the page number as a parameter then check the results to see if they are less than the page size, if the returned results are less than the page size then you are at the end. This functionality is shown in the code sample for getUsers():

http://www.blackberry.com/developers/docs/bds/bws/enterprise/admin/6.0.0/com/rim/ws/enterprise/admin...

 

#2, this is described in the parameters section of the getUsers call:

pageSize - number of users to return on the current page. A page size less than or equal to zero will return all of the remaining users on a single page.

Garett
@garettBeuk
--
Goodbye everybody!