cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
435
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Martin A. on 03-03-2010 10:24:43 AM
Hi!

Found a strange phenomenon while doing a phonebook search using the API.

TX: xcommand phonebook search phonebooktype: "corporate" searchstring: "" folderid: "c_2"

RX: OK
RX: *r ResultSet ResultInfo TotalRows: 52

.... some rows later...

RX: *r ResultSet Contact 50 ContactMethod 2 ContactMethodId: "846"
RX: *r ResultSet Contact 50 ContactMethod 2 Number: "SIP***@***.se"
RX: *r ResultSet Contact 50 ContactMethod 2 Protocol: SIP
RX: ** end

Resultset states that the search gave 52 hits, but the actual result is just 50 hits.

I always used "*r ResultSet ResultInfo TotalRows: " to dynamically size my arrays. Is this an assumption I'm not allowed to make or do we have a bug?

Here's some system info:

*s SystemUnit ProductType: "TANDBERG Codec"
*s SystemUnit ProductId: "TANDBERG Codec C90"
*s SystemUnit Uptime: 172251
*s SystemUnit Software Application: "Endpoint"
*s SystemUnit Software Version: "TC2.1.2.203904"
*s SystemUnit Software Name: "s52000"
*s SystemUnit Software ReleaseDate: "2009-12-10"

Kind regards,
Martin

Subject: RE: Phonebook search
Replied by: David Bruun-Lie on 03-03-2010 11:00:47 AM
Hi Martin,

the TotalRows tells you the number of total number of rows found for the search you did. However the number of rows returned is dependent on how many rows you have requested to be returned (default being 50!) . The TotalRows is useful for paging-functionality

Hm, this is not easy to explain without an example:

Say I want to display 10 and 10 entries on the phonebook page. I would issue (in your case):
1xcommand phonebook search phonebooktype: "corporate" offset: 0 limit:10 folderid: "c_2"

This will give me the first 10 entries. The codec will still report "*r ResultSet ResultInfo TotalRows: 52"
Since I now know there are 52 entries in total to show, this tells me that I should have a "next page" button to page down to the next entries:
1xcommand phonebook search phonebooktype: "corporate" offset: 10 limit:10 folderid: "c_2"

I will now get the next 10 entries.
I do this until TotalRows < Offset + Limit.

I suggest you stop using dynamic sizing of the array and rather have a fixed size that you use to set the number of entries you want back in the search in the "limit" attribute.

If you want to have more than 50 entries returned each time, again just set the limit attribute to the number of rows you want returned :-)

Hope this helps!

Best Regards,
David

Subject: RE: Phonebook search
Replied by: Martin A. on 03-03-2010 11:23:35 AM
Thank you David for prompt reply!

Adding "limit: 1000" gave me the result i wanted. I use a good processor so I have no problems parsing lots of data in minimum of time.

/Martin
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links