Hi Everyone,
I have been stuck on this XML parsing data to JSL for awhile, I can do it at one level but not at 2 levels.
I have this XML as below:
<Menu name="AAA" role="PP">
<Item name="XXX" value="-11.9" />
<Item name="YYY" value="7.1" />
<Item name="Tool" value="121"/>
<Item name="POSITION" value="301"/>
<Item name="ID" value="1562" />
</Menu>
<Menu name="BBB" role="PP">
<Item name="XXX" value="-1.9" />
<Item name="YYY" value="4.1" />
<Item name="Tool" value="121"/>
<Item name="POSITION" value="301"/>
<Item name="ID" value="1562" />
</Menu>
I need the output table to look like this one:
AAA_XXX | AAA_YYY | BBB_XXX | BBB_YYY |
-11.9 | 7.1 | -1.9 | 4.1 |
So far, I have this JSL code but it can only do IF condition at 1 level, but not at 2 levels for Menu and Item.
On Element( "Item",
Starttag(
If( XML Attr( "name") == "XXX",
column( dt, "AAA_XXX")[row()] = Num( XML Attr( "value"))/10;
);
If( XML Attr( "name") == "YYY",
column( dt, "AAA_YYY")[row()] = Num( XML Attr( "value"))/10;
);
If( XML Attr( "name") == "XXX",
column( dt, "BBB_XXX")[row()] = Num( XML Attr( "value"))/10;
);
If( XML Attr( "name") == "YYY",
column( dt, "BBB_YYY")[row()] = Num( XML Attr( "value"))/10;
);
)
Can you please kindly help me out?
Thank you.