To limit the number of records per XML document
- How can I limit the number of records per XML document?
- What steps do I need to take to limit the number of records per XML document?
- How can I use Variables and Codeunits to limit the number of records per XML document?
- How can I use a Variable to check the selected Partner?
Tip
Summary: This chapter provides instructions on how to limit the number of records per XML document. It explains how to create a Variable Key for RecCount, set the Variable Value to [RecCount] + 1, set the Run Time to After Record, choose the Set DIS Codeunit action, set the Parameter field to BREAKLOOP, set the Run Time field to After Record, select Constant in the Value Class field, enter [RecCount] for the Value, set the Validation Type to Equal (=), and enter 10 for the Value. Additionally, it suggests closely checking the BreakLoop functions of Partner Mapping and Record Pool.
The number of Records within an XML file can be limited by a combination of Mapping Variables and Mapping Codeunits, or by setting up the Autom. BreakLoop after Records field if looping through a Record Pool.
For this example, the number of records is limited so only the first ten Items are exported to an XML file.
- Open the Mapping created in the Create a Simple XML Export exercise.
- Select the main Mapping Line and then choose Variables on the Lines FastTab. Create a Variable Key for RecCount, set the Variable Value to [RecCount] + 1 and Run Time to After Record. With this, the Variable is increased by 1 after each Record.
- While still on the main Mapping Line, choose Codeunits on the Lines FastTab. Choose the Set DIS Codeunit action and then set the Parameter field to BREAKLOOP and the Run Time field to After Record.
- On the Codeunits page, choose Criteria. In the Value Class field, select Constant and enter [RecCount] for the Value. Ensure that the Validation Type is set to Equal (=) and enter 10 for the Value. With this setup, the run breaks only after ten passes, i.e., if the Mapping Variable RecCount corresponds to 10.
If required, the Criteria can be extended for a special Partner by using a Variable, like PartnerCode, to check the selected Partner.
Note
By running through a Record Pool, the BreakLoop functions of Partner Mapping (Repeat if BreakLoop for Record Pool) and Record Pool (Autom. BreakLoop after Records) should be checked closely.
Feedback
Submit feedback for this page .