Get specific value from a DataTable

I have a datatable saved in a Variable. I have all the dates of the year in column A and in Cloumn B I got different values. I need to get the value from a date choosed by the user (Date is stored in a DateVariable). Any suggestions?

Please use Select method of data table to find the desired value.

For example:
resultRows[] = YourDataTableVariable.Select("ColumnA=#" + DateVariable.ToString(mm/dd/yyyy) + "#")

If resultRows.Count is equal to 1 then you had exactly one matching row.
If zero, not found
If more than 1, then are more than one matching rows.

To access the columnB value, resultRows(0)("Column B").ToString

Regards,
Karthik Byggari

2 Likes

Do you mean I should use a Assign activity to put in that code string? Cause I can only find Select Range looking for a select activity.

Yes. Use assign activity.
The output of assign activity is array of data rows.

I cant make it work… I get the message "Cannot assign from type “System.Data.DataRow” to type “System.String” in Assign.

Please change the destination type. You are assigning the result to a wrong data type.

@KarthikByggari - thanks, of course, Should have thought that out.

1 Like

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