on 09-24-2007 8:18 PM
Hi ,
lets say I have the source structures
Header(1--unbounded)
..|
..|__Line(0-unbounded) (this is sub structure,not at the same level of header)
and note Line Items might exist or not as the occurence is 0---unbounded
and I have created the target structure like
Header(1-1)
|
|
LINE(1-1)(at the same level of header)
and let say I get the LINE values like,with # delimited
abcd#1234#xyz#ggbv
xyz#dgage#srhseh#xfsh
........
......
......
like this 'n' line items.
I want in the target like
1abcd#1234#xyz#ggbv
2xyz#dgage#srhseh#xfsh
...........
.......
n values of 'n'th item
and the next Line items should start with '1" again ,if Line items exist in the source.
so,how can I achieve this,I tried with different standard funtions in(count,Index,counter and combination of with different node functions) MM,do I need to have UDF for this?
COUNTER function works but not giving me the initiation again for the new LINE items.ie,starting from'1' again
thank you,
Babu
Hi,
As I understand, on source side, you have following structure:
Header (1 to unbounded)
Item (0 to unbounded)
And this structure should be mapped to following target structure:
Header (1-1)
Item (1-1)
Thus, a nested souce structure is to be mapped to flat target structure. I would perform following mapping for such case:
Item (Source, contex Header) -> Index (Starting value as 1) -> Remove Context (This function would remove context since on target side we need values in one context) -> Split by value (on each value) -> output field.
Try this to check if it works for you.
Thanks,
Bhavish
Kindly award points if comments are useful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Bhavish and Jagadish.
Bhavish your approach worked.I did exactly what you said.
I need to change the ITEM context to the HEADER in the source and REMOVE CONTEXT -- SPLITBY VALUE --Target
Jagadish,
Thank you for your support,in your case problem is, I have the main root of my target structure 1-1 occurence where as you have 1-unbounded(TAR in your scr)
thank you both again.
Babu
Hi Babu,
Map field under LINE Node in target as follows
LINE (<b>S</b>) ->index(Standard Statistic function)->SplitByValue[Each value]->output
<b>S</b> - Source
suppose if you have input data as
[H]
--[LINE1]
--[LINE2]
--[LINE3]
[H]
--[LINE10]
--[LINE20]
The above mapping generates <b>output</b> as
[1]
[2]
[3]
[CC]
[1]
[2]
if you want output without starting from '1' again use the following logic in mapping
LINE (<b>S</b>) ->removeContext ->index(Standard Statistic function)->SplitByValue[Each value]->output
it generates output as
[1]
[2]
[3]
[4]
[5]
Please let me know if you need any other details.
Thanks,
Jag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jagadish,
let me try ,infact I tried combination of node functions and INDEX or COUNT ,but I used node functions first and then INDEX or COUNT ,let me try node functions after INDEX or COUNT.First I will try your way (provide its no going to effect my ourput structure)and then different combinations.
thank you.
Jagadish,
I tried the way you told me.
first approach "LINE (S) ->index(Standard Statistic function)->SplitByValue[Each value]->output
S - Source"
giving me
just
H1
1LINE
1LINE
1LINE
H2
1LINE
1LINE
....
...
second approach is right its giving exactly whata you told.
"LINE (S) ->removeContext ->index(Standard Statistic function)->SplitByValue[Each value]->output"
H1
1LINE
2LINE
3LINE
H2
4LINE
5LINE
...
....
I tried different options based on this like changing the context of the source ,I tried on the node of LINE .even in different ways applying context change on LINe node I am able to get always
H1
1LINE
2LINE
3LINE
H2
4LINE
5LINE
...
but never like the way I wanted.
H1
1LINE
2LINE
3LINE
H2
1LINE
2LINE
...
...
any more suggestions?
thank you ,
babu
Hi Babu,
> first approach "LINE (S) ->index(Standard Statistic
> function)->SplitByValue[Each value]->output
> S - Source"
> giving me
> just
> H1
> 1LINE
> 1LINE
> 1LINE
> H2
> 1LINE
> 1LINE
i guess you are mapping element under <b>LINE</b> Node but in my mapping i used <b>LINE</b> node as source.
if you want to use element under <b>LINE</b> node as source just change element context to <b>Header</b>.
you display source element or node queue it should be as
[]
[] - 3 Items under first Header
[]
[CC]
[]
[] -2 Items under second Header
i guess currently your source queue output as
[]
[CC]
[]
[CC]
[]
[CC]
[]
[CC]
.....
.....
......
thats why you are getting output as
H1
1LINE
1LINE
1LINE
H2
1LINE
1LINE
Please let me know if you have issues still.
Thanks,
Jag
"i guess you are mapping element under LINE Node but in my mapping i used LINE node as source.
if you want to use element under LINE node as source just change element context to Header."
I tried this option too,but my mapping fails .even I changed the context of the subelement in the LINE node.but no use.
I will double check .or can you send me screen shot how you are mapping?
thank you,
Babu
Hi Babu,
Are you able to see queue for source node as i have given in previous post?
http://www.flickr.com/photos/14144840@N02/1440819098/
In this Screen shot i mapped <b>item</b> node ,in your case its <b>LINE</b> Node
Please let me know if you need further other details.
Thanks,
Jag
Hello,
XSLT is feasible!!!
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Babu,
Do you have any parent node for <b>Header</b> node in target structure?
if yes, then you might have to repeat <b>Header</b> node and its elements
<b>Line</b> number of times.
Thanks,
Jag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.