on 10-20-2015 1:23 PM
Hello
I am struggling with an XML file where the structure looks like this.
<task taskName="GRN Capture" taskStartTime="2015-09-25T10:14:26.217" taskEndTime="2015-09-25T10:14:53.423">
<activity activityName="Image" text="" activityImageNo="1D00456B-07CD-49F9-8F89-568816C54020"/>
<activity activityName="Text Input" text="706061"/>
</task>
<task taskName="Asset Deliveries" taskStartTime="2015-09-25T10:14:55.803" taskEndTime="2015-09-25T10:15:06.457" imageNo="TR010000005C0F020F6B991EF710759BD37D8FCC4382751897E9597715">
<activity activityName="BB Basket" text="" number="4.000"/>
<activity activityName="Metal Wheel" text="" number="1.000"/>
</task>
<task taskName="Asset Returns" taskStartTime="2015-09-25T10:15:07.307" taskEndTime="2015-09-25T10:15:17.110">
<activity activityName="BB Basket" text="" number="3.000"/>
<activity activityName="Metal Wheel" text="" number="1.000"/>
</task>
I want to retrieve the value of text="706061"/> where taskname ='GRN Capture'.
My issue is this taskname GRN can come in any of the position in the task and the subsequent asset deliveries and asset returns might or might not have an activity node. Due to various combinations, my useoneasmany or graphical mapping is not working.
Is there a simple udf where i can retrieve the text = 706061 with the taskname GRN capture which will cater all the permutations and combinations.
Appreciate if you can post that with the parameters as well that i need to pass.
Regards
Sam
Hello Sam,
I would not go for UDF in this case, as it still requires playing around with contexts. Have you already tried formatByExample function? Together with mapWithDefault and correctly set context it should solve your issue.
Regards,
Radek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If it is because of missing values please try mixed approach: mapWithDefault to ensure that there are no empty values and simple UDF (type all values of queue) to map fields based on activityName:
for (int i=0; i < activityName.length;i++)
{
if (activityName[i].equalsIgnoreCase("Text Input"))
{ result.addValue(text[i]);
}
}
One more question, how many occurences of text="706061" are required in a target message? If it is one or one per higher level node maybe you should try mapping variable?
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.