Find row number in data table / (datatable) in Studio


I have been all over this forum, and just can’t seem to find how to find a row number in a data table.

Attached is a screen shot of the XAML file.

CustGroupDT (data table) has two columns:
Col 1 = CustGroupDropDown, containing the string values, and
col 2 is CustGroupSequence of INT32, containing a sequential number. Now whether I count the rows (if I’m looking for “Retailer”) or using col 2, is not a problem. The most efficient method would be appreciated.

How do I get the numeric row value of the “Retailer” value in the CustGroupDT data table?

Hi @herman

U mean u need to get rowindex if particular value in datatable ?

Hi Nived,

Correct, I’m looking for the row number of a specific value/string in the DT.

Try this Lookup Data Table

Hi @herman

Did u tried with lookup datatable activitiy ?

Apologies for the late reply - I have utilised Lookup Data Table activity, but the write line on RowIndex gives me a -1. Assuming the value I’m looking for is not in the DT, although the string conversion of the DT does show it

I have put a Watch on the DT, and the value I’m looking for is in there.

Screenshot 1 shows the CustGroupDT watch,
while screenshot 2 shows the DataTable and LookupValue
screenshot 3 shows the write line for RowIndex output as -1

Any ideas why I get a -1 when write line Test

Hi @herman

I think the value u are looking is under first column so column index should be 0 instead of one in lookupdatatable propertypanel

Hope it works


Nived N

Happy Automation

Thanks, I kept using Column 1 - solved it!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.