Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Number of Pages in Report?

JamesByroads1
Contributor III

Hey All,

 

Does anybody have a good way to determine the number of pages in a report that I am pulling through the SOAP API?

 

At the moment, I know the report is 1 page and I have hard-coded 1 into the api call.  However, the report will eventually grow to 2 pages, 3 pages, etc.  I don't want to have to worry about going back into the code and updating the number of pages in a report.

 

As a little context, my report includes cross-reference fields.

 

I thought maybe I could use the value at the top of the xml where it gives a count.  I have seen where this number was greater than 250, so I thought maybe it was capturing total records across all pages.  I could essentially divide by 250, round up, and that would tell me the number of pages.  But that does not seem to align with the number of pages in the report.

 

<?xml version="1.0" encoding="UTF-16"?>

<Records count="50">

 

I didn't see an API call that returns the number of pages.  The only thing I can think of is creating a while loop that checks the results of the API call to see if returned records/data or not.  Then have a counter that iterates up to check if the next page has results.  I wanted to check with community first though to see if there is a better way to do it.  Thanks!

...

10 REPLIES 10

I think, as you've stated, you're seeing the inconsistency because of cross-references.

 

I have a couple of reports that I extract using .net.  I noticed that ONLY the one report that has multiple cross-references has an inconsistency in the record count returned from the web method.

 

If I pull up the report in Archer, it shows (at the top of the report page in Archer) that it has 3,591 records.

archer record count.png

When I export that to .csv it also comes out to being 3591 rows. 

 

However, I'm noticing that the cross-references are causing multiple rows for the same target record in the .csv.

 

My report is Applications --> Legal Entity --> Supplier.

So, for example,  I have a record that has all the same application content on 2 rows, but only one of them has the legal entity and only one has the supplier info.  

 

*As an aside, if I enforce relationships, I only get 356 records, which is not what I want.

 

When I use the SearchRecordsByReport, it tells me the record count is 3399. 

record count from webservice xml.png

I divide that by 250 and get the number of pages.  I have compared this output to the Archer export of the report and although the row count is off, the data appears to be accurate.  I don't have duplicate rows and my cross-referenced data is on 1 row.

 

So, as long as you're looping through your pages correctly, I think you should be able to get the right number of rows and data.

 

Lastly, as a best practice... Our process around doing extracts of reports has been to let the requester of that report know that we'll be creating our own private copy of their report (that only our api has access) so that any changes they make to their report doesn't impact my code... And, if they want future changes, they need to submit a request to us to have us change it.  This way you don't get issues of row counts or new relationships/fields, etc.