Data binding using dynamic list input parameters

I have a file saved with the following format:

Item 1    Item 2
1223      3223

I have a script that add item to cart. What I want is that my test should look at the file, if it has 2 items as in case of the first entry above, then it should run the add item to cart twice, once with item 1223 and once with item 3223.

But during the next cycle, I want my test to execute the add item to cart just once, since this time it has only one item. (1231)

Can someone help me with this. Thank you

Perhaps a for loop, or while loop, for the number of rows that will test checking if there is a value or not in column 1 and maybe a case block to determine if there is some value in columns for the maximum columns.

The case block can be put into a Keyword with the number of columns to test against as the methods return value.


Is it possible to apply for loop to data file with internal data type?

What is your “Internal Data Type”?. However, this was what I was thinking about; I changed from a case block to a while for the columns.

Maybe like
for (row = 1; row <= data.getRowNumbers(); row++) {
    "determine how many columns"
    boolean hasFound = false
	col = 2
    maxCol = 1
	while (!hasFound) {
		if (data.getValue(row, col) == "") {
			maxCol = col - 1
            hasFound = true
    for (col = 1; col <= maxCol; col++) {
      //  blah blah blah
      println "the value is " + data.getValue(row, col).toString() 
      WebUI.comment("the value is " + data.getValue(row, col).toString() )