Datatable select cannot return row

studio

#1

Hi, I have a workflow where I need to input a stock code and its details into a Datatable.
But if the stock code has been entered before I want it to not create a new row but find its first input and edit there.
I have managed to create a workflow which it can identify whether it has input the stock code before, and if boolean is True, it will use Datatable.select to return an array of rows and will use rows.indexof(arrayofrows(0)) to return the index of its initial input.

But recently it is throwing an index is out of bounds error and its because the datatable select is returning 0 rows but there should have been an input. I’ve printed the datatable out and confirmed that.


#2

Can you share a workflow


#3

I managed to solve it.
Apparently, the stock code entered into the datatable is not always stored as string but could be in integer format as well. So instead of datatable.select("[ColName] = ‘"+stockcode.tostring+"’"), I’ve added a "or [ColName] = “’+stockcode+”’ "

I think this is because while I’ve specifically asked robot to enter stockcode(generic value) as string using “add data row”, Excel still recognizes it as integer sometimes?


#4

Yes it does recognize integers and strings according to formats used in excel