Page 1 of 1

Help Regarding Loop Variables inside a Sequence Job

Posted: Wed Oct 24, 2012 7:29 am
by ArunsundarIndira
Hi All,

I have a issue in getting all the values of the a single parameter ( which is a file name that is dynamically generated while looping) used inside a loop at the end of the loop in a variable.

For e.g.

Loop 1 : var1 = 'file1.sql'
Loop 2 : var1 = 'abc.sql'
Loop 3 : var1 = 'xyz.sql'

I want a variable to hold all the values of variable var1 out of the loop.

Thanks in Advance,
Arun.

Posted: Wed Oct 24, 2012 8:07 am
by ArndW
A Variable holding "file1.sql,abc.sql,xyz.sql" outside the loop, then use a comma for the loop separator.

Posted: Wed Oct 24, 2012 8:08 am
by ArndW
oops, I see you want it the other way around. Put a user variable activity and generate "BigString" as "BigString:',':$Loop.Loopvariable"

Posted: Wed Oct 24, 2012 10:46 am
by bhasds
Hi Arun,

If you are getting the values of a single parameter from a file then using list loop can help you.

1. Cat the file with execute command|xargs|tr -d '\n'
Eg- Output will be file1.sql abc.sql xyz.sql
2.Pass the command output to the loop using list loop.
3.Get the execute command output in a user variable activity once the loop is finished through a activity variable.

Please correct me if I am wrong.

Posted: Tue Oct 30, 2012 3:58 pm
by rameshrr3
Arndw: Will you not need 2 user variables ?

Posted: Wed Oct 31, 2012 4:21 am
by ArndW
No two user variables are needed. Just one outside the loop to hold the string containing the loop elements, then the loop counter itself will hold each value for each iteration.