cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to use if else condition in xml generator snap

Mahesh7225
New Contributor

Hello Team
how we can use if else condition in xml generator snap
here is my query

image

here either Expt have value or Sco have value not in both (Expt,Sco)
i want to display

case 1)if vatPer = 0.0  and if Expt tab have value then display Expt tab 
expecting like this

image

case 2)if vatPer = 0.0  and if Sco tab have value then display Sco tab	

image

can you please help

Thank you

3 REPLIES 3

koryknick
Employee
Employee

I believe this is what you are asking for. The attached pipeline uses Apache Velocity to handle the if-then-else logic to output the appropriate containers in the xml. I created an array of objects to show both the 0.0 and non-zero case, which allowed me to also demonstrate for-loop logic to loop through the array contents.
XML Generator if-then-else_2021_05_13.slp (5.1 KB)

Hello Koryknick
Thank you for reply
But still its not resolve my issue , my expectation is like this if xml input is
case 1) if xml input is then output should be
image

Case 2 ) if input is then output should be
image

Case 3 ) if input is then output should be
image

Thank you

bojanvelevski
Valued Contributor

Hey @Mahesh7225 ,

I made some adjustments on the @koryknickโ€™s pipeline and I belive that this is what you was looking for,

XML Generator if-then-else_DELETE_2021_05_14 (1).slp (5.3 KB)

Try and manually adjust cases in the JSON Formatter one by one.

Best Regards,
Bojan