Skip to Content
avatar image
Former Member

Mapping Help

Hi All,

I have a specific requirement where I have to repeat a target segment with respect to the integer value of a source element.

Source Structure

<Ticket Print>

--> Store(0..1)

-->TicketSize(0..1)

--> Item(0..n)

------>Header(0..1)

------>Counter(0..1)

------->StartDate(0..1)

-------->TicketQty(0..1)

Target Structure is also same

But I have to repeat Item node with respect to ticket quantity.

Source XML

<Ticket Print>

<Store>23<Store>

<TicketSize>2</TicketSize>

<Item>

----><Header>A</Header>

----><Counter>1</Counter>

----><StartDate>20130517</StartDate>

----><TicketQty>2</TicketQty>

<Item>

----><Header>B</Header>

----><Counter>2</Counter>

----><StartDate>20130517</StartDate>

----><TicketQty>1</TicketQty>

TargetXML

<Ticket Print>

<Store>23<Store>

<TicketSize>2</TicketSize>

<Item>

----><Header>A</Header>

----><Counter>1</Counter>

----><StartDate>20130517</StartDate>

----><TicketQty>1</TicketQty>

<Item>

----><Header>A</Header>

----><Counter>1</Counter>

----><StartDate>20130517</StartDate>

----><TicketQty>1</TicketQty>

<Item>

----><Header>B</Header>

----><Counter>2</Counter>

----><StartDate>20130517</StartDate>

----><TicketQty>1</TicketQty>

So the Item node shud repeat as per the value of ticket qty in source.

Ticket qty will have only value 1 in XML.

Can you please suggest any idea on how to proceed.

Regards,

Malini

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 17, 2013 at 12:21 PM

    hi

    pass this TicketQty to below udf.

    for(int i=0;i<ticketQty;i++)

    {

    result.addvalue("");

    }

    ticketQtry-->UDF-->ItemNode

    if ticketQty not coming sometimes try with exists and createif functionality

    Regards,

    Loordh

    Add comment
    10|10000 characters needed characters exceeded