How to loop through input file
Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
2 posts
Page 1 of 1
Hiya - I'm using a database task to select all records in a file. Each record contains two fields. I'd like to read one record at a time, and use the two fields in later steps. How do I control the reading and know when I'm at the end of file?
Thanks!
Thanks!
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
llovelace,
When you retrieve data from a database, you are creating a "rowset" variable as output. (Example MyData)
You can use a "ForEach" loop (Across ${MyData}) to loop through that rowset and address each record (MyRec for example).
During that looping, you can address each field of that record by it's index value -- ${MyRec[1]} ... ${MyRec[2]} -- to associate with the 1st field, 2nd field, etc...
The loop will automatically end at the end of the Rowset (${MyData}).
You could also save the values into local variables for use later if needed. (setvariable MyVar = ${MyRec[1]}.
Hope this helps!
When you retrieve data from a database, you are creating a "rowset" variable as output. (Example MyData)
You can use a "ForEach" loop (Across ${MyData}) to loop through that rowset and address each record (MyRec for example).
During that looping, you can address each field of that record by it's index value -- ${MyRec[1]} ... ${MyRec[2]} -- to associate with the 1st field, 2nd field, etc...
The loop will automatically end at the end of the Rowset (${MyData}).
You could also save the values into local variables for use later if needed. (setvariable MyVar = ${MyRec[1]}.
Hope this helps!
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts
Page 1 of 1