How to address a specfic cell in a rowset

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

toniduquette

Posts: 7
Joined: Thu Aug 21, 2014 3:43 pm

Post by toniduquette » Fri Jan 22, 2016 3:10 pm
Hello,
I would like to set a variable using a value in a particular cell from a rowset created from ReadExcel task.
For example, I want to use a date value in Row 1, Column 4. How to I reference the cell to set the variable?

The only reference I can find is to the column index, as in ${ExcelForDate[4]}.
Is there a row index I can reference?

Thank you.

Support_Tim

Posts: 33
Joined: Mon Dec 01, 2014 10:35 am

Post by Support_Tim » Mon Jan 25, 2016 5:38 pm
Hi toniduquette,


A Row Set variable is designed to be all inclusive to simplify the data translation process, but you can access data in a specific row of a rowset.

You can create a forEach loop with a Current Item Variable and a Current Iteration Variable (Found on the Basic and Advanced tabs respectively). The Current Item Variable ${currItem} is the current row, starting with the first and going to the last. The Current Iteration Variable counts the number of times the loop is processed, starting with 1.

So, based on the value of the iteration variable ${loopCount}, you can move the desired value of the Current Item Variable’s column 4 ${currItem[4]} into a variable with a Set Variable task. Below I have the condition statement within the Set Variable task (Control tab), but you could also use an IF statement to set this condition.


ForEach Loop Example:

<project name="C 35580 Test" mainModule="Main" version="2.0" logLevel="verbose">

<module name="Main">

<createWorkspace version="1.0" />


<readCSV inputFile="/wtmccall/MyTest.csv" outputRowSetVariable="rowSet" version="1.0" />

<forEachLoop itemsVariable="${rowSet}" currentItemVariable="currItem" currentIterationVariable="loopCount">

<setVariable label="Get Value of Row 3 Col 4" name="row3col4" value="${currItem[4]}" version="2.0" executeOnlyIf="${loopCount eq 3}" />

</forEachLoop>

<deleteWorkspace version="1.0" />

</module>

</project>
2 posts Page 1 of 1