List to Group in XML Stage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
shiva459
Premium Member
Premium Member
Posts: 100
Joined: Wed Jun 11, 2003 1:49 am
Location: Bangalore

List to Group in XML Stage

Post by shiva459 »

I am processing a xml file using XML Pack stage. The hierarchy in the input tab in XML parser step looks like below.

Code: Select all

Application(List)
<Elements>
    Credit Application(Group)
          <Elements>
         Credit Request(Group)
             <Elements>
              Credit Details(Group)
                  <Elements>
                  Balance Transfer(List)
                   <Elements>
              Offer(List)         
                <Elements>
              Decision(Group)
                <Elements>
I picked Applications as the root and when I check the mappings tab, I did not see Balance Transfer and Offer in the source list. If I make these two lists into groups using 'List to Group', they show up in the source and I am able to map to the output link. I am not well familiar with XML but is there an undesirable result because of converting list into group? If so, what is the alternative. If one of you dealt with it in the past, please advise.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

It depends. There are a variety of reasons for usiing list to group....the most common is when you have a list that is "unbounded" in the xsd but in real life never occurs more than once.

Hard to say what your issue is..but consider this best practice.....in the mappings tab, before you do ANYTHING else .....map the lowest level list (blue icon) to the list with the name of your output link. Then map any parents or anything else that yoipu need, and for initial testing, just click propagate to push all the elements "of that lowest desired list" onto the output link.

Get that lowest level list working as multiple rows before moving on to other nodes that are higher.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
kurics40
Premium Member
Premium Member
Posts: 61
Joined: Wed Nov 18, 2009 10:01 am

Re: List to Group in XML Stage

Post by kurics40 »

Hi Shiva,

The same stuff stole 5 hours of my life...
Than I pissed off and I tried to made everything what possible this "Group To List" option.

It gives no error finaly.

Somehow I liked more when I needed to add the XPATH descriptions, than this fency stuff. This on just prepare and prepare and after you come back with a coke and popcorn and you have it.

I was doing this for the same purpose like you. For the flatted row(s) from the XML. Order join step after this:
Left:one of the sublist. I think I chose with minoccurs=1.
right: InputLinks

I am developing this right now. I ll update you.
kurics40
Premium Member
Premium Member
Posts: 61
Joined: Wed Nov 18, 2009 10:01 am

Re: List to Group in XML Stage

Post by kurics40 »

Hi Shiva,

I did ..something again.

1. Group To List everything in the begining. Why? Because I dont understand but now it doesnt give any error message.
2. switch with all relevant lists
3. Order join step: Right : which has value all the time (parent) Left : child
both of them from switch

What did I get from this one to many XML?

many lines, where the one row source had only once a row.

If we have 1 row from parent, 3 rows from child:
Parent will be filled only once. BUT! The xml keys can be multiplied! So we are safe. :)


Parent , child, version, concent,sysdate, key1,key2
---------------------------------------------------------------
PID1,CID1,34,DarwinPrice,2019-04-13...., realkey1,realkey2
NULL, CID2,34,DarwinPrice,2019-04-13...., realkey1,realkey2
NULL, CID3,34,DarwinPrice,2019-04-13...., realkey1,realkey2
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Good to know, thanks for posting that.

Just for grins, you do realize that you replied to a five year old post and that Shiva hasn't posted for three, yes? May just split you out to your own informational post and link it back to this one. We'll see. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
kurics40
Premium Member
Premium Member
Posts: 61
Joined: Wed Nov 18, 2009 10:01 am

Post by kurics40 »

That is ok. What can stop Shivra to pay attention to this post a after 3 years.

I have been asked in the job to do the same with more complex xsd. Well. I can not make it. I create switches where minocccurs=0. I don't know why but if one elemnt is null than the complete group is unavailable. I make list of those groups what I want to separate with swithces.

I try to sort join all of the lists with each other where I minoccurs=0 and maxoccurs = onbounded


Sometimes I receive error message with cursor error. I have the XML Pack but it seems like I had luck with simple xsd.

What is the rule what I need to follow?
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

There are MANY nuances for the hierarchical stage. Critical best practice one is to always map your bottom list first, to your output link, before you do ANYTHING else. Second....one repeating path per output link. Third....parse and get out......do joins and aggregations outside of the stage. There are many more, but those are some of the most critical. Also, be sure to ready the redbook on this stage and keep it handy as a reference.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The rule you need to follow? Basically, when you have a problem you would like help on, you start a new post.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply