on 01-30-2014 10:38 AM
Hi,
I have a requierement that file will be received in the below format.
But in Target structure Header should be populated based on the group of fields "a" and "c" where in "a" field should be uniquely considered. i.e. Header should come 4 times.
Please suggest if this can be achieved through Graphical mapping? if not please help me with the UDF.
Thank you.
<Deatils>
<a>13thNov</a>
<b>23</b>
<c>1.1</c>
<d>101</d>
</Details>
<Deatils>
<a>14thNov</a>
<b>21</b>
<c>1.2</c>
<d>101</d>
</Details>
<Deatils>
<a>14thNov</a>
<b>23</b>
<c>1.1</c>
<d>102</d>
</Details>
<Deatils>
<a>15thNov</a>
<b>23</b>
<c>1.1</c>
<d>101</d>
</Details>
<Deatils>
<a>15thNov</a>
<b>23</b>
<c>1.1</c>
<d>101</d>
</Details>
<Deatils>
<a>16thNov</a>
<b>23</b>
<c>1.1</c>
<d>101</d>
</Details>
Hi V R,
Did I get your requirement right, that you need to create one Header for each unique value of field a? If so, use the following mapping:
a -> removeContexts -> splitByValue(Value Change) -> collapseContexts -> Header
Regards,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Greg/Vila/GB,
You got me wrong, sorry for the confusion, hope the below can be more clear.
Below is the Source structure we receive:
In that structure we could see the highlighted rows are 5 with the common values from "d" fields.
But while generating the Header it should be 4 headers for the highlighted based on the count of distinct "a" fields where in the respective "d" fields are same and another header with the "d" field of 102..
So totally from the above, the target structure will have 5 Headers based on "a" field and "d" field.
Please help me out.
Thank you so much.
Dear V R,
My solution proposal is still valid after this additional explanation, all you need to do is add concat at the beginning, as follows:
a, b -> concat (separator e.g. "_") -> removeContexts -> splitByValue(Value Change) -> collapseContexts -> Header
Depending on whether your input is already sorted or not, you might have to sort it yourself, in addition to the logic above.
Regards,
Greg
Hi VR
You can use the function formatByExample but when you map the a field you should put before splitbyvalue the function sort following this example:Stefan Grube's blog
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.