cancel
Showing results for 
Search instead for 
Did you mean: 

Remove "AND" from the last element

0 Kudos

Dear All,

We have a requirement to build query based on the fields (Cloumn,operator,values) and generate value for the Text field as shown in the below screenshot.

For each query line item, we should add "AND" at the end and values should be populated in single quotes.

Mapping

Output

Input

<?xml version="1.0" encoding="UTF-8"?>

<root>

<query>

<column>BUKRS</column>

<operator>EQ</operator>

<values>9370</values>

</query>

<query>

<column>BUDAT</column>

<operator>LIKE</operator>

<values>202206%</values>

</query>

<query>

<column>BLDAT</column>

<operator>LIKE</operator>

<values>202206%</values>

</query>

<query>

<column>XBLENR</column>

<operator>LIKE</operator>

<values>4530</values>

</query>

</root>

Expected Output

<?xml version="1.0" encoding="UTF-8"?>

<root>

<options>

<Text>BUKRS EQ '9370' AND</Text>

</options>

<options>

<Text>BUDAT LIKE '202206%' AND</Text>

</options>

<options>

<Text>BLDAT LIKE '202206%' AND</Text>

</options>

<options>

<Text>XBLENR LIKE '4530'</Text>

</options>

</root>

Please help me to achieve this requirement.

Thanks in advance.

Regards

Revathi CH

View Entire Topic
0 Kudos

Hi!

I would put count(query) to the variable and check if the index() of current "query" item is equal to the stored value.

Regards, Evgeniy.

0 Kudos

Hi Evgeniy,

Thank you for your suggestion. i have created another mapping with the below logic and it worked.

Regards

Revathi CH