Question & Answer
Question
How can one call an API in a generic manner to fetch all the records that satisfy a criterion from any growing table?
Answer
The problem here is, by default system picks up the maximum number
of records (either from MaximumRecords=” ” passed in the input XML
or from the yantra.app.maxrecords property value present in yfs.properties.
This property is applicable to all get APIs. One can override it by passing
MaximumRecords=” ” at API level.
Now if a user runs getOrderLineList API, over time, the number of
records in order line table keeps increasing. If one invokes a custom code to
fetch all the eligible records, then it is not possible to change the value of
MaximumRecords dynamically. Therefore, one needs a generic solution to handle
this situation.
The
solution:
Write a complex query (frame input XML to
support complex query) with MaximumRecords passed to fetch bunch of records at
a time.
For example, in a getShipmentList
API, call the getShipmentList API with complex query specifying an order by
shipment header key and pull 100 records at a time. In the complex query place
the last picked shipment key with ShipmentKey > “<last picked shipment
key>” to fetch the next set of records until the API returns 0
records.
Sample input
XML:
<Shipment DocumentType="0001"
EnterpriseCode=<Enterprise Code> MaximumRecords="5" ShipNode=<Ship Node>
ShipmentClosedFlag="N" ShipmentKey=<Shipment Key> ShipmentKeyQryType=<Query
Type></span></div> <div>
<Attribute
Name="ShipmentKey" desc="false" />
</OrderBy>
</Shipment>
[{"Product":{"code":"SS6PEW","label":"IBM Sterling Order Management"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]
Historical Number
HTG2251
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21562002