Page XMLPort results

KarlRhodesKarlRhodes Member Posts: 37
I'd like to know if its possible to page the results in an XMLPort. Please bear with me, I don't normally work in Navision as I'm a C# developer and I've been tasked with investigating the most appropriate method of creating web services for a web based application...

In a standard Navision 2016 Cronus installation there are 42 sales orders, and I have created an XMLPort that takes some parameters (such as an account number etc) and 2 of these parameters are the page size and the page number of the data I'd like returned.

I have added code to establish how many pages there are, and what to do if the numbers don't match (such as asking for page 11 if only 10 pages are available based on page size) but I don't know how to filter the records so that I only get the records for a given page.

In my working example, I want to query the Sales Header table (which has a SourceTableView filter set to only show Orders) and pass in a PageSize parameters with a value of 5, and a PageNumber parameter with a value of 3. I would expect to receive records 11-15 in the result set, but I do not know where to apply the filter in the code on the XMLPort.

I have been putting my code in the "Sales Header - Export::OnPreXMLItem()" function/method but I still get all 42 orders returned.

I understand how to Step to the start of the records I want back ( "Sales Header".NEXT(intSteps); ) but it always seems to return all the Order headers.

As well as this - and once I have successfully stepped to the correct start position - how do I get it to only return the next 5 (PageSize) records?

For reference, my XMLPort looks like this...

Node Name Node Type Source Type Data Source
Orders Element Text <Orders>
Request Element Text <Request>
OrderNo Element Text <OrderNo>
PageNumber Element Text <PageNumber>
PageSize Element Text <PageSize>
Status Element Text <Status>
Code Element Text <Code>
Message Element Text <Message>
RequestResult Element Text <RequestResult>
RecordCount Element Text <RecordCount>
PageCount Element Text <PageCount>
Response Element Text <Response>
OrderList Element Text <OrderList>
Order Element Table <Sales Header>(Sales Header)
DocumentNo Element Text <DocumentNo>
Amount Element Text <Amount>
OrderLine Element Table <Sales Line>(Sales Line)
LineNo Element Text <LineNo>
ItemNo Element Text <ItemNo>
Description Element Text <Description>
Quantity Element Text <Quantity>
UnitPrice Element Text <UnitPrice>


Sign In or Register to comment.