Skip to Content
0

Splitting records

Apr 09 at 09:00 AM

59

avatar image

Hi SDNites,

I am working on a requirement where I will receive multiple line items and we have to use the details of these line items to further details from 3rd party system (I will be using Request-Reply for this).

The complexity is above scenario is,

Each line items have multiple codes present into it (codes are not mandatory and may or may not come). Also the codes have priority corresponding to it so we have to fetch details with the first code and if the value is found then do not use 2nd code for fetching else use it and in the same manner process all line items to fetch data.

Example,

Lets say code in the order of priority are A,B,C,D

Input XML fileis like this,

<Parent>
<Line Item>
<Recordno>1</Recordno>
<F1>B</F1>
<F1_Value>use value in Request-Reply</F1_Value>
<F1>C</F1>
<F1_Value>use value in Request-Reply</F1_Value>
</Line Item>

<Line Item> (Notice here that codes tag is not fixed and can come into any tag)
<Recordno>1</Recordno>
<F1>C</F1>
<F1_Value>use value in Request-Reply</F1_Value>
<F1>A</F1>
<F1_Value>use value in Request-Reply</F1_Value>
</Line Item>

<Line Item> (Notice here only 1 code is sent)
<Recordno>1</Recordno>
<F1>B</F1>
<F1_Value>use value in Request-Reply</F1_Value>
</Line Item>

<Line Item>
<Recordno>1</Recordno>
<F1>D</F1>
<F1_Value>use value in Request-Reply</F1_Value>
<F1>A</F1>
<F1_Value>use value in Request-Reply</F1_Value>
</Line Item>

</Parent>

In the above we have to fetch details based on priority A,B,C,D and if the records using first priority is found do not progress further and if not found progress further. Once all the details are fetched, we have to gather all the records under 1 XML so that I can use it for further logic.

Any pointer will be of great help.

Regards,

Abhishek

10 |10000 characters needed characters left characters exceeded

Hi SDNites,

Any pointers will be of great help.

Regards,

Abhi

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Morten Wittrock
Apr 09 at 04:32 PM
0

Hi Abhi

Your question is quite broad, but I can give you some general pointers, that will get you started.

To iterate over line items, use a Splitter step, which you'll find in the palette's Message Routing category.

The logic determining how details are looked up per line item is not entirely clear to me. It does, however, sound like you could implement it fairly easily in a Script step, storing the value to be used in the lookup in a property.

The lookup itself is done with a Request Reply step, as you rightly state.

Map the result of the lookup using the mapping type of your choice, and then I assume you would want to collect the responses (one for each line item) using a Gather step (also located in the Message Routing category).

Good luck and have fun.

Regards,

Morten Wittrock

Share
10 |10000 characters needed characters left characters exceeded