in XMLoutput stage more than one repeat element
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 106
- Joined: Wed Oct 04, 2006 5:21 am
in XMLoutput stage more than one repeat element
Hi ,
Can I use more than one repeat(key column) element in xml output stage under input columns tab?
Example:-
input:-
PORD1,DETAL1
PROD2,DETAIL2
PROD3,DETAIL3
Actual Getting output:-
<IDOC>
<PROD_HEADER>xyz</PROD_HEADER>
<PROD1>
<DETAIL1>
</DOC>
<IDOC>
<PROD_HEADER>xyz</PROD_HEADER>
<PROD2>
<DETAIL2>
</DOC>
<IDOC>
<PROD_HEADER>xyz</PROD_HEADER>
<PROD3>
<DETAIL3>
</DOC>
Required output:-
<IDOC>
<PROD_HEADER>xyz</PROD_HEADER>
<PROD1>
<DETAIL1>
<PROD2>
<DETAIL2>
<PROD3>
<DETAIL3>
</IDOC>
How can I get all product details in single IDOC with single <PROD_HEADER> tag.If I select both PROD and DETAIL column as a keys in xml output stage it is coming in different IDOCs.If any body have thoughts please suggest me.
Thanks,
Praveen.
Can I use more than one repeat(key column) element in xml output stage under input columns tab?
Example:-
input:-
PORD1,DETAL1
PROD2,DETAIL2
PROD3,DETAIL3
Actual Getting output:-
<IDOC>
<PROD_HEADER>xyz</PROD_HEADER>
<PROD1>
<DETAIL1>
</DOC>
<IDOC>
<PROD_HEADER>xyz</PROD_HEADER>
<PROD2>
<DETAIL2>
</DOC>
<IDOC>
<PROD_HEADER>xyz</PROD_HEADER>
<PROD3>
<DETAIL3>
</DOC>
Required output:-
<IDOC>
<PROD_HEADER>xyz</PROD_HEADER>
<PROD1>
<DETAIL1>
<PROD2>
<DETAIL2>
<PROD3>
<DETAIL3>
</IDOC>
How can I get all product details in single IDOC with single <PROD_HEADER> tag.If I select both PROD and DETAIL column as a keys in xml output stage it is coming in different IDOCs.If any body have thoughts please suggest me.
Thanks,
Praveen.
Re: in XMLoutput stage more than one repeat element
Hi,
what is the Xpath you have given for the columns ?
one try - what if you dont give the key columns ?
what is the Xpath you have given for the columns ?
one try - what if you dont give the key columns ?
Short answer - no. Only one repeating / key element. That's not to say you can't generate these as 'chunks' and then assemble the chunks into the complete output format that you need after that. The Best Practices document uploaded at Kim Duke's website details this technique.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 106
- Joined: Wed Oct 04, 2006 5:21 am
There seems to be a conflict here of "rows" vs "columns". Is PORD1 a column name, or a value in a row? Right now, these are listed as individual and unique items --- but they are on separate rows. If indeed you just want all six elements in the same repeating group, then put them into the same repeating "row" for each prod_header:
prod1 detail1 prod2 detail2 prod3 detail3
Otherwise, are these really "values" for two columns, <PROD> and <DETAIL>.......
Please be explicit in your example...this info is key to figuring out the output that you need. XMLOutput is very dependent upon the structure and organization of the incoming rows and the way that they repeat.
Ernie
prod1 detail1 prod2 detail2 prod3 detail3
Otherwise, are these really "values" for two columns, <PROD> and <DETAIL>.......
Please be explicit in your example...this info is key to figuring out the output that you need. XMLOutput is very dependent upon the structure and organization of the incoming rows and the way that they repeat.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
-
- Participant
- Posts: 106
- Joined: Wed Oct 04, 2006 5:21 am
Hi,eostic wrote:There seems to be a conflict here of "rows" vs "columns". Is PORD1 a column name, or a value in a row? Right now, these are listed as individual and unique items --- but they are on separate rows. If indeed you just want all six elements in the same repeating group, then put them into the same repeating "row" for each prod_header:
prod1 detail1 prod2 detail2 prod3 detail3
Otherwise, are these really "values" for two columns, <PROD> and <DETAIL>.......
Please be explicit in your example...this info is key to figuring out the output that you need. XMLOutput is very dependent upon the structure and organization of the incoming rows and the way that they repeat.
Ernie
PROD1,DETAIL1 are the values not columns names.
Exact output would be expecting is:
<IDOC>
<PROD_HEADER>xyz..</PROD_HEADER>
<PROD>PROD1</PROD>
<DETAIL>DETAIL1</DETAIL>
<PROD>PROD2</PROD>
<DETAIL>DETAIL2</DETAIL>
<PROD>PROD3</PROD>
<DETAIL>DETAIL3</DETAIL>
</IDOC>
We are getting output in the following way:
<IDOC>
<PROD_HEADER>xyz..</PROD_HEADER>
<PROD>PROD1</PROD>
<DETAIL>DETAIL1</DETAIL>
</IDOC>
<IDOC>
<PROD_HEADER>xyz..</PROD_HEADER>
<PROD>PROD2</PROD>
<DETAIL>DETAIL2</DETAIL>
</IDOC>
<IDOC>
<PROD_HEADER>xyz..</PROD_HEADER>
<PROD>PROD3</PROD>
<DETAIL>DETAIL3</DETAIL>
</IDOC>
Could you please suggest me for the expected output?
Thanks,
Praveen.
There are a couple of things to try...
One is to be sure that you are aggregating your rows.... second is to wrap the <prod> and <detail> elements in a compound element (for a test just put something like /test/ in the middle of the xpath statements..so where you have /.../.../.../prod/text(), make it /.../.../.../test/prod/text(), and do the same for detail.) Most times repeating groups of this kind are "contained" within an overall wrapping element, such as:
<lineitem><prod/><price/><quantity/></lineitem>
Most likely you don't want the extra element, but the result will tell us more, and/or provide a solution that is easy to implement.
Ernie
One is to be sure that you are aggregating your rows.... second is to wrap the <prod> and <detail> elements in a compound element (for a test just put something like /test/ in the middle of the xpath statements..so where you have /.../.../.../prod/text(), make it /.../.../.../test/prod/text(), and do the same for detail.) Most times repeating groups of this kind are "contained" within an overall wrapping element, such as:
<lineitem><prod/><price/><quantity/></lineitem>
Most likely you don't want the extra element, but the result will tell us more, and/or provide a solution that is easy to implement.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
...one more thing....is it just these two columns that you are dealing with, or are many....10's or hundreds of columns?
Ernie
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
-
- Participant
- Posts: 106
- Joined: Wed Oct 04, 2006 5:21 am
Hi Ernie,eostic wrote:...one more thing....is it just these two columns that you are dealing with, or are many....10's or hundreds of columns?
Ernie
Thanks for suggestions.
In my case I am having total 12 segments.For each segment I have more that 10 columns.
Example:-
<xmldoc>
<segment1>
<seg1-tag1>
<seg1-tag2>
.
.
<seg1-tag10>
</segment1>
<segment2>
<seg2-tag1>
<seg2-tag2>
.
.
<seg2-tag10>
</segment2>
<segment3>
<seg3-tag1>
<seg3-tag2>
.
.
<seg3-tag10>
</segment3>
.
.
.
.
<segment12>
<seg12-tag1>
<seg12-tag2>
.
.
<seg12-tag10>
</segment12>
</xmldoc>
In the above example segemnt1 should come only once in the xmldoc.The remining 11 segments will repeat based on how many records we are getting from source.Here my problem is exactly if I select the all 11 segments as a key column in xmloutput stage it is repeating the xmldoc for each source record.if I select the 1 segment as a key column in xmloutput stage it is also repeating the xmldoc for each source record.
The final out put I am getting is if I have 100 source records I am getting 100 xmldocs but actually requirement is one xmldoc with segement1 is one reminig 11 segment would repeat 100 times.
Could you please suggest me on the same?
Thanks,
Praveen.
...take a look thru the forum here, and find referecnes to the XML Best Practices doc that is at Kim Duke's site. It documents what you need to do here. Now it is more clear. XMLOutput will be able to create a single relational oriented structure for you. This means one single lowest level repeating node. If there are other independent repeating nodes (elements) at the "same" level, then you will need multiple (perhaps many) different XMLOutput Stages to put this together. If it's only a few different nodes, it's not too complex, but can get unwieldy if you have a deeply spread out hierarchy.
A single path nested hierarchy will work fine:
<rootElement>
<child>
<childDetail>
<grandchild>
<grandchildDetail>
<great grandchildTypeA>
<greatgrandchildDetail1>
<greatgrandchildDetail2>
<greatgrandchildDetail3>
But independent repeating children nodes at the same level require a mulit-stage technique:
<rootElement>
<child>
<childDetail>
<grandchild>
<grandchildDetail>
<great grandchildTypeA>
<greatgrandchildDetail1>
<greatgrandchildDetail2>
<greatgrandchildDetail3>
</greatgrandchildTypeA>
<ggTypeB>
<ggTypeBDetail>
</ggTypeB>
A real life example might be an xml document for a Customer. After customer account details, there might be a repeating node for "purchases" made by the customer in the past year. Separately, there might be a repeating node for "repair visits" that the company has made to the customer for service. Both nodes are related to customer, but repeat independently.
This is no different than having multiple relational tables to model the same thing, or a multi-path hierarchical structure in a COBOL file or VSAM/IMS when looking at legacy structures.
Ernie
A single path nested hierarchy will work fine:
<rootElement>
<child>
<childDetail>
<grandchild>
<grandchildDetail>
<great grandchildTypeA>
<greatgrandchildDetail1>
<greatgrandchildDetail2>
<greatgrandchildDetail3>
But independent repeating children nodes at the same level require a mulit-stage technique:
<rootElement>
<child>
<childDetail>
<grandchild>
<grandchildDetail>
<great grandchildTypeA>
<greatgrandchildDetail1>
<greatgrandchildDetail2>
<greatgrandchildDetail3>
</greatgrandchildTypeA>
<ggTypeB>
<ggTypeBDetail>
</ggTypeB>
A real life example might be an xml document for a Customer. After customer account details, there might be a repeating node for "purchases" made by the customer in the past year. Separately, there might be a repeating node for "repair visits" that the company has made to the customer for service. Both nodes are related to customer, but repeat independently.
This is no different than having multiple relational tables to model the same thing, or a multi-path hierarchical structure in a COBOL file or VSAM/IMS when looking at legacy structures.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
...btw, I am assuming that your "segments" above are unique from each other and repeat independently (ie..you could get 2 seg1's and 1 seg3, and 4 seg7's).
...and if they aren't unique, and are really just repeating "instances" of the same thing ,why do they have unique element names?
Ernie
...and if they aren't unique, and are really just repeating "instances" of the same thing ,why do they have unique element names?
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
-
- Participant
- Posts: 106
- Joined: Wed Oct 04, 2006 5:21 am
Hi Ernie,eostic wrote:...btw, I am assuming that your "segments" above are unique from each other and repeat independently (ie..you could get 2 seg1's and 1 seg3, and 4 seg7's).
...and if they aren't unique, and are really just repeating "instances" of the same thing ,why do they have unique element names?
Ernie
Exatly these segments are unique and these will repeat independently.
Can I get it resolve the issue?
Thanks,
Praveen.
I suspected as much. See if you can get what you want with just the first segment......
and then another link that goes to an xmlOutput stage that produces what you want with the second segment...
...and so forth.....
Each segment must be built independently....then hooked up later. This is usually done via lookups, but there are other techniques. See the xml best practices document that you can download at Kim Dukes site.
Ernie
and then another link that goes to an xmlOutput stage that produces what you want with the second segment...
...and so forth.....
Each segment must be built independently....then hooked up later. This is usually done via lookups, but there are other techniques. See the xml best practices document that you can download at Kim Dukes site.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
We are all happy, Kim that you are the "keeper" of it ; ) I've had a copy from the day it was written, but long ago grew tired of emailing it. and.....people ought to take time to visit your site anyway....so this is a good reason to do so if they haven't already!
One of our developers wrote that document a long while ago...however, it is still current, has ideas on some great techniques, and will even give you a "little" education on xpath.
Good luck!
Ernie
One of our developers wrote that document a long while ago...however, it is still current, has ideas on some great techniques, and will even give you a "little" education on xpath.
Good luck!
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>