cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping help

Former Member
0 Kudos

Hi,

I am doing a jdbc to flat file,

I have the below input structure

<row>

<order>

<customerno>

<id>

<sid>

<qty>

<price>

</row>

I need the output file as below

order#customerno#id

sid#qty#price

sid#qty#price

sid#qty#price

order#customerno#id

sid#qty#price

sid#qty#price

order#customerno#id

sid#qty#price

sid#qty#price

order#customerno#id are header fields which occur once and sid#qty#price are details which repeat

how should I desing my output structure and map them,what node functions do I need to use?I am fine doing FCC once the mapping is done

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

order#customerno#id

sid#qty#price

sid#qty#price

sid#qty#price

order#customerno#id

sid#qty#price

sid#qty#price

order#customerno#id

sid#qty#price

sid#qty#price

Target_MT

-->Header(0..unbounded)

-


>Order

-


>Customer

-


>ID

-->Records(0..unbounded)

-


>sid

-


>qty

-


>price

Now in FCC put Recordset as Header,,Records,

Field Seperator as #

Header and Records have 0..unbounded and are at same level.

Babu

Former Member
0 Kudos

Thanks for the reply, please see the source example below, if the header fields are same then only the detail has to come and header should not repeat, do I need to write any udf for this?

<row>

<order1>

<customerno1>

<id1>

<sid1>

<qty1>

<price1>

</row>

<row>

<order1>

<customerno1>

<id1>

<sid2>

<qty2>

<price2>

</row>

<row>

<order2>

<customerno2>

<id2>

<sid3>

<qty3>

<price3>

</row>

<row>

<order2>

<customerno2>

<id2>

<sid4>

<qty4>

<price4>

</row>

output file

order1#customerno1#id1

sid1#qty1#price1

sid2#qty2#price2

order2#customerno2#id2

sid3#qty3#price3

sid4#qty4#price4

Former Member
0 Kudos

Hi,

No its not required.

Since the occurence u are going to give in the FCC is as Header,,Records, hence doesnt matter

Babu

Former Member
0 Kudos

I dont think you got my point, when the header is repeating I should only display the detail record under the previous header record

Former Member
0 Kudos

Any help appreciated

baskar_gopalakrishnan2
Active Contributor
0 Kudos

for your output structure

output file

order1#customerno1#id1

sid1#qty1#price1

sid2#qty2#price2

order2#customerno2#id2

sid3#qty3#price3

sid4#qty4#price4

Recordset structure is Header, 1, details, *

Former Member
0 Kudos

Hi,

Ok now, we have a header and Records for every order.

You want to remove the all the Header elements from target payload for which you have same combination.

Use one more Message Mapping in the same Interface Mapping, which will remove these header nodes which are repeating.

This second mapping will be executed after the first mapping in sequence.

Let us know if still you face the problem...

Babu