Forum Discussion
Not sure what exactly the further.
Is that you need to ignore the last line (Rows=1) which is not actual data?
Then you change it from:
if (index) {
to:
if (index && (lines.size() != index+1)) {
Usually I try before providing the code snippet. Looks this case I was lazy to do so as split would do the job with |, but it requires escaping. Sorry about it.
So here is the change code, this would also take care of additional row in the last line:
def lines = new File('/tmp/data.txt').readLines() lines.eachWithIndex { line, index -> if (index && (lines.size()-1 != index)) { // handles extra unwanted last line def data = line.split('\\|')*.trim() //CustRefID field's index 0 log.info data[0] } }
Now, it appears that you wanted to do the further processing with each CustRefID? In that case
Hope you can alter the step sequence as below
DataSource - DirectoryType (fileContents property)
POST /path/synchronous-upload <-- this POST publishes the fileContents property
GroovyStep <-- to extract the CustRefID value from the fileContents property
for each CustRefID
save CustRefID at test case level
run step from with in groovy step ==> GET /path/contact?CustRefID=${#TestCase#CustRefID}