LucMertensSteri
12 years agoNew Contributor
Using "For Each" in a property transfer
I have to transfer values from 1 request to another to reuse a generated Key.
The first request contains the following xml:
<!--1 or more repetitions:-->
<SmartMeterMeterReadingDocumentERPCreateRequestMessage>
<MeterReadingDocument>
<ID>ID1${=new java.text.SimpleDateFormat("YYYYMMddHHmmss").format(new Date())</ID>
</MeterReadingDocument>
</SmartMeterMeterReadingDocumentERPCreateRequestMessage>
<SmartMeterMeterReadingDocumentERPCreateRequestMessage>
<MeterReadingDocument>
<ID>ID2${=new java.text.SimpleDateFormat("YYYYMMddHHmmss").format(new Date())</ID>
</MeterReadingDocument>
</SmartMeterMeterReadingDocumentERPCreateRequestMessage>
this results in a unique ID, even when the request is launched multiple times.
The second request contains the following xml:
<!--1 or more repetitions:-->
<SmartMeterMeterReadingDocumentERPBulkCancellationRequestMessage>
<MeterReadingDocument>
<ID>Must Be ID 1</ID>
</MeterReadingDocument>
</SmartMeterMeterReadingDocumentERPBulkCancellationRequestMessage>
<SmartMeterMeterReadingDocumentERPBulkCancellationRequestMessage>
<MeterReadingDocument>
<ID>Must be ID 2</ID>
</MeterReadingDocument>
</SmartMeterMeterReadingDocumentERPBulkCancellationRequestMessage>
Now I can decalare 2 transfers where the origins are to be defined like this:
//.../SmartMeterMeterReadingDocumentERPCreateRequestMessage[1]/MeterReadingDocument/ID
//.../SmartMeterMeterReadingDocumentERPCreateRequestMessage[2]/MeterReadingDocument/ID
And the destinations like:
//.../SmartMeterMeterReadingDocumentERPCancellationRequestMessage[1]/MeterReadingDocument/ID
//.../SmartMeterMeterReadingDocumentERPCancellationRequestMessage[2]/MeterReadingDocument/ID
This works fine.
But the problem is that I have multiple examples, and some contains up to 1000 rows.
Is there a way to generate this in a loop form?
Thanks for your help
Luc Mertens
The first request contains the following xml:
<!--1 or more repetitions:-->
<SmartMeterMeterReadingDocumentERPCreateRequestMessage>
<MeterReadingDocument>
<ID>ID1${=new java.text.SimpleDateFormat("YYYYMMddHHmmss").format(new Date())</ID>
</MeterReadingDocument>
</SmartMeterMeterReadingDocumentERPCreateRequestMessage>
<SmartMeterMeterReadingDocumentERPCreateRequestMessage>
<MeterReadingDocument>
<ID>ID2${=new java.text.SimpleDateFormat("YYYYMMddHHmmss").format(new Date())</ID>
</MeterReadingDocument>
</SmartMeterMeterReadingDocumentERPCreateRequestMessage>
this results in a unique ID, even when the request is launched multiple times.
The second request contains the following xml:
<!--1 or more repetitions:-->
<SmartMeterMeterReadingDocumentERPBulkCancellationRequestMessage>
<MeterReadingDocument>
<ID>Must Be ID 1</ID>
</MeterReadingDocument>
</SmartMeterMeterReadingDocumentERPBulkCancellationRequestMessage>
<SmartMeterMeterReadingDocumentERPBulkCancellationRequestMessage>
<MeterReadingDocument>
<ID>Must be ID 2</ID>
</MeterReadingDocument>
</SmartMeterMeterReadingDocumentERPBulkCancellationRequestMessage>
Now I can decalare 2 transfers where the origins are to be defined like this:
//.../SmartMeterMeterReadingDocumentERPCreateRequestMessage[1]/MeterReadingDocument/ID
//.../SmartMeterMeterReadingDocumentERPCreateRequestMessage[2]/MeterReadingDocument/ID
And the destinations like:
//.../SmartMeterMeterReadingDocumentERPCancellationRequestMessage[1]/MeterReadingDocument/ID
//.../SmartMeterMeterReadingDocumentERPCancellationRequestMessage[2]/MeterReadingDocument/ID
This works fine.
But the problem is that I have multiple examples, and some contains up to 1000 rows.
Is there a way to generate this in a loop form?
Thanks for your help
Luc Mertens