How to get first value from the row - with inconsistent column

I am reading data through screen scraping: This is the sample data:

I need to assign the number 901 to a variable.
Sometimes it gets populated in first column/other times in second column.

I don’t want the other number.
And the second number can be a whole number or decimal. I only need the first occurrence of a number.
Any help would be appreciated.
Thanks

Hi @chauhan.rachita30,

Use output datatable activity to convert datatable to string and use refer to get first occurrence of the full number.
Use Below regex pattern
/[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)/

Or

Convert.ToString(Dt.row(0)(0))
Check string.isnullorempty condition if null get the second column value using below code
Convert.ToString(Dt.row(0)(1))

Regards,
Arivu

1 Like

Hi,

Hope the following sample helps you.

Sample20211222-1.zip (8.9 KB)

Regards,

1 Like

Hi, Thanks for helping. I have found another solution. I have taken an empty string. and assigning the first value to that empty string if its numeric. I cannot use break because I need to read through other values in the table.


Next time when it will read the numeric value in the other column, it wont go inside this if.

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