Maybe it would sound like something that has been already asked in many previous topics , but I am LITERALLY running out of sorts to understand how exactly the loop structure works in Transformers stages . I am posting this after being utterly confused by the facts given in the IBM Online manuals of datastage.....
Please ,somebody help me understand the process of loops in transformers (especially for aggregating data in groups using LastRowInGroup, SaveInputRecord() and GetSaveINputRecord() functions)
None of previous posts related to these topics have laid down the step-by-step flow of how to work with loops.
Looking forward to hearing from you people.
Thanks,
Kumarjit.
Need to know the basics of working with Loops in Transformer
Moderators: chulett, rschirm, roy
Need to know the basics of working with Loops in Transformer
Pain is the best teacher, but very few attend his class..
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi there,
Thanks for responding ..... There are lots of stuffs related to transfomer looping, that I wasnt able to decipher, especially the examples mentioned in the link below:
http://publib.boulder.ibm.com/infocente ... mple4.html
In the first example , there are a couple stage variables declared,namely NumSavedRows,IsBreak, TotalPrice, SummingPrice and NumRows
Now, my understanding is , value of a stage variable will be set for EACH INPUT RECORD. If this is true,
Question 1 . What would the value of NumSavedRows and NumRows be for each record , and why ?
Question 2. How come NumSavedRows be reset each time the last row in group(grouping based on distinct values of col1) in encountered ? As because NumSavedRows=SaveInputRecord(), it will be a continuous series of sequence staring from
1 to 7 , if all the seven records of the data source is cached .
There are many more things to ask , but dont want to load the post .
@ Ray : As because you are a premium member of this community, all that you post ends up into is a big GOLDEN BUTTON named "Premium Content" which takes me far away from the material content of your post .It would be greatly appreciating if you send in you reply to this post
via a Private Message , or any other means so that I get to read to the fullest .
Thanks again,
Kumarjit.
Thanks for responding ..... There are lots of stuffs related to transfomer looping, that I wasnt able to decipher, especially the examples mentioned in the link below:
http://publib.boulder.ibm.com/infocente ... mple4.html
In the first example , there are a couple stage variables declared,namely NumSavedRows,IsBreak, TotalPrice, SummingPrice and NumRows
Now, my understanding is , value of a stage variable will be set for EACH INPUT RECORD. If this is true,
Question 1 . What would the value of NumSavedRows and NumRows be for each record , and why ?
Question 2. How come NumSavedRows be reset each time the last row in group(grouping based on distinct values of col1) in encountered ? As because NumSavedRows=SaveInputRecord(), it will be a continuous series of sequence staring from
1 to 7 , if all the seven records of the data source is cached .
There are many more things to ask , but dont want to load the post .
@ Ray : As because you are a premium member of this community, all that you post ends up into is a big GOLDEN BUTTON named "Premium Content" which takes me far away from the material content of your post .It would be greatly appreciating if you send in you reply to this post
via a Private Message , or any other means so that I get to read to the fullest .
Thanks again,
Kumarjit.
Pain is the best teacher, but very few attend his class..
-
- Premium Member
- Posts: 376
- Joined: Sat Jan 07, 2012 12:25 pm
- Location: Piscataway
Oopskumarjit wrote:@ Ray : As because you are a premium member of this community, all that you post ends up into is a big GOLDEN BUTTON named "Premium Content" which takes me far away from the material content of your post .It would be greatly appreciating if you send in you reply to this post via a Private Message , or any other means so that I get to read to the fullest .
Jerome
Data Integration Consultant at AWS
Connect With Me On LinkedIn
Life is really simple, but we insist on making it complicated.
Data Integration Consultant at AWS
Connect With Me On LinkedIn
Life is really simple, but we insist on making it complicated.
The 'any other means' you are looking for would be to purchase a Premium Membership which goes towards maintaining and supporting this site and which would allow you to see the full content of any premium posts on the site - not just from Ray but he is the Big Kahuna of our little island.
It won't help much in this particular case as you've seen the fullest content of his initial reply to you.
It won't help much in this particular case as you've seen the fullest content of his initial reply to you.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Re: Need to know the basics of working with Loops in Transfo
However, the examples in the manual you linked to are surprising complete and well explained, much better than the so called 'examples' I grew up with.kumarjit wrote:None of previous posts related to these topics have laid down the step-by-step flow of how to work with loops.
Have you tried building the job and the source data described in the tutorial? Did it not work for you? Or it did and the exact 'why' of that is what is unclear?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Re: Need to know the basics of working with Loops in Transfo
I had a couple of questions .
1. Is the loop executed ahead of the evaluation of the stage vairables,for a single input record ?
2. The Stage Variable NumSavedRows cannot be set to SaveInputRecord() because a correponding GetSavedInputRecord() needs to invoked , and that too within a loop variable . I dont know the reason for such behavior .
3. Stage variable NumRows is set to NumSavedRows if the record is NOT the last record in a group else 0. If we consider the first record of the input, LastRowInGroup would return FALSE, so NumRows must be = value of SaveInputRecord fuction for that row, which is 1, and for the last row in the group , NumRows should be 0, but when I fetch values of NumRows in the output, it is equal to the number of records in that group . Why is the value of NumRows stage variable same for all the records in the group , because as per definition of SaveInputRecord(), this should vary on the basis of record count in the cache .
There are many more to ask , but not enough space to wite into .....
Please help.
Thanks
Kuamrjit.
1. Is the loop executed ahead of the evaluation of the stage vairables,for a single input record ?
2. The Stage Variable NumSavedRows cannot be set to SaveInputRecord() because a correponding GetSavedInputRecord() needs to invoked , and that too within a loop variable . I dont know the reason for such behavior .
3. Stage variable NumRows is set to NumSavedRows if the record is NOT the last record in a group else 0. If we consider the first record of the input, LastRowInGroup would return FALSE, so NumRows must be = value of SaveInputRecord fuction for that row, which is 1, and for the last row in the group , NumRows should be 0, but when I fetch values of NumRows in the output, it is equal to the number of records in that group . Why is the value of NumRows stage variable same for all the records in the group , because as per definition of SaveInputRecord(), this should vary on the basis of record count in the cache .
There are many more to ask , but not enough space to wite into .....
Please help.
Thanks
Kuamrjit.
Pain is the best teacher, but very few attend his class..