on 03-11-2011 4:57 AM
Hi,
I'm working on File to Idoc scenario, where I'm populating 5 quantity info from file to Idoc in a different filelds. And I have one more field in Idoc, where I need to populate the summation of these 5 quantities.
where thes quanties are may or maynot contain from the structure. My code is working, if all the Items have the quantity info..but in real time, they may contain null values and some times they dont have nodes as well. can you guys help me on the same. Is there anything we can deal this with global container?
Input XML:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:MT_Test xmlns:ns1="http://test.com/todo">
<RECORD>
<Header>
<Header1>HeaderInfo</Header1>
<Header2>W</Header2>
<Header3>00005</Header3>
<Header4>20</Header4>
</Header>
<Item_Details>
<Child_Info>
<Item1>
<Invoiced_Quantity>0000001</Invoiced_Quantity>
<Part_Number>1524251</Part_Number>
</Item1>
<Item2>
<Invoiced_Quantity/>
<Part_Number/>
</Item2>
<Item3>
<Invoiced_Quantity>0000003</Invoiced_Quantity>
<Part_Number>1524253</Part_Number>
</Item3>
<Item4>
</Item4>
<Item5>
<Invoiced_Quantity>0000005</Invoiced_Quantity>
<Part_Number>1524255</Part_Number>
</Item5>
</Child_Info>
</Item_Details>
</RECORD>
</ns1:MT_Test>
Note: Header (1-1), ItemDetails (1--Unbounded), Child_Info (1-Unbounded)
-Esha
Edited by: esha nadh on Mar 11, 2011 6:02 AM
>>My code is working, if all the Items have the quantity info
Please let us know, if you are using standard functions or UDF for this.
>>they may contain null values and some times they dont have nodes as well.
For verifying if node is not present, you can make use of MapwithDefault function with value like 0.
If null values, if you are using UDF you can easily compare it with IF satatement as:
if (quantity.equals(""))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to Use these two node functions to solve your problem
MAPWITHDEFAULT
This function returns to target some default value when a empty context is coming from source side.
EXISTS
Function return true, if node exists else return false.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.