Splitting files based on a number of records

In order to make this flow work you need to perform the following steps:

1. In the Process Designer create a process flow variable with the following parameter:

Name: recordSize
Value: Enter numeric value here say 5 (This is equal to number of records you want to split at a time)

2. Use the attached file contents in the Gateway condition in the Process Designer.

3. Create a new mapping activity and load the same schema on both the source and target side and create following 3 local variables at the root element

Name= varStart
Value= get-context(startPosition ,1 )

Name= varEnd
Value= get-context( endPosition,1 )

Name= varSetTotalCount
Value= set-context(totalCount , count( $Input_AdvPos_Invoice/Root/Record_ID_Header-HDR) )

Note: Replace the above xPath with the actual xPath of the source record.

4. Append the following condition to the for-each applied on record:

[position()>=$varStart and position()<=$varEnd]

Note: If the Source xml has multiple elements then you need to add the above for-each statement every target element schema.

Here's a sample process flow diagram:


Also use the rule in the gateway condition

Have more questions? Submit a request


Article is closed for comments.