Page 1 of 1

Start Loop passing just first row into the loop

Posted: Mon Jul 30, 2018 6:07 pm
by UAUITSBI
Hello,

I have a text file (pipe delimited) with 3 rows. I am combining these 3 rows with a ',' (comma) as delimiter via Execute Command Stage. I am passing the output of the execute command to the Start Loop to define delimited values.
Issue: When running the job, 3 iterations are performed as expected but only first row is being passed in all those 3 iterations. Not sure why start loop activity is not picking all 3 rows.

I designed a sequencer job as below:

Code: Select all

ExecuteCommand --> UserVariableActivity (to Trim @FM) --> StartLoopActivity (Defined output from UserVariableActivity) --> UserVariableActivity (To set values from the row to the columns in table) --> Parallel_Job --> End Loop Activity
Example: Three rows in the file:
Row1: AB|CD
Row2: EF|GH
Row3: IJ|KL

Single Row: AB|CD,EF|GH,IJ|KL

When passing the above row into the loop only AB|CD row is being processed 3 times.

Any help in this regards is much appreciated.

Thanks.

Posted: Mon Jul 30, 2018 6:36 pm
by chulett
Are you leveraging $Counter when you pass the parameter from the loop to the Job Activity stage?

Posted: Mon Jul 30, 2018 6:51 pm
by UAUITSBI
@chulett -- Thanks for bringing that up. No I am not leveraging $Counter from start loop in the Job Activity. I am using User Variable Activity to set values for the parameters in the table (in job activity).

How can I leverage the $Counter in job activity when I am setting values for the parameters in the job activity from user variable activity ?

Posted: Mon Jul 30, 2018 7:33 pm
by chulett
How are you passing it now? It's been quite a while but from what I recall you should be able to simply add ".$Counter" to what you are doing now so that it iterates properly inside the loop. One sec...

There's an example here.

Posted: Tue Jul 31, 2018 8:48 am
by UAUITSBI
@chulett: I am currently using UserVariableActivity inside the loop to derive the parameters coming from a file and in the job activity stage I am assigning these values to the job parameters in the job activity.

I am including images:

Example: Parameter value of 'AB' (from text file) is been assigned 'Code' parameter in the job:

UserVariableActivity: Code: Field(Exec_Read_File.$CommandOutput, '|',1)
https://ibb.co/fNbHM8

Job Activity: For parameter name Code: UserVariableActivity.Code
https://ibb.co/hs8iTo

Loop Activity: https://ibb.co/iXau18

How can I leverage $Counter in the above scenario ?

Thanks for the help thus far.

Posted: Tue Jul 31, 2018 10:02 am
by chulett
I'll have to check later, your image site is blocked here.

Posted: Tue Jul 31, 2018 10:29 am
by UAUITSBI
I will try with other image hosting site.

Job Activity:
https://imgur.com/gFsV786

User Variable Activity:
https://imgur.com/5RhoHkw

Loop Activity:
https://imgur.com/mDdXtwx


Thanks.

Posted: Tue Jul 31, 2018 11:14 am
by chulett
Okay. Don't you just need to set the UserVariables once, not each time through the loop? Typically, it would be before the Start Loop stage to set the delimited list it loops through. Can you show us the properties in the Start Loop stage itself, please?

Posted: Tue Jul 31, 2018 11:45 am
by UAUITSBI
Yes that makes sense to use outside the loop. But still I need to map the UserActivity variables in the job activity to pass the parameters.

Below is the Start Loop Properties:

https://imgur.com/aykaFJk

Posted: Tue Jul 31, 2018 11:57 am
by UAUITSBI
I have moved the user variable activity to the outside of the loop but still just first row is getting looped all 3 times.

Posted: Tue Jul 31, 2018 12:31 pm
by chulett
Right, that will continue to happen until $Counter comes into play. Sadly, fighting my own fires right now. Did you look at the example from IBM I posted earlier, specifically Figure 5 on that page? Hopefully that helps.

Posted: Tue Jul 31, 2018 1:25 pm
by UAUITSBI
@chulett: You are right! I have used Field($Counter,'|',1) in job activity and that picked up second and third row respectively.

Thanks for the help !

Posted: Tue Jul 31, 2018 1:34 pm
by chulett
8)