Find specific value


#1

Hi Guys,

Another case:
In SAP I have the Table (matrix) which columns (picture attached)
I used DataScraping and store the whole matrix in DataTable.
I need to look at the Column “Status” and find the first row where I have one of the following number:
601
610
700
710
720
730
740
750
760
770
790
and store this number in a variable
Table

Thank you!


#2

Hello niteckam,

I recommend using a ‘for each’ activity to determine if the numbers you are checking for are present. Since you have the data stored as a DataTable you can use a for each activity that examines each row in column “Status”. Then, use an ‘If’ decision along with an ‘Assign’ activity to assign the variable to number if it exists in the column.


#3

Can you use the Export to save the table to a file (I think Export would be in the top Menu bar where File is)? If so, you can use the data table to find the row items, and click/select them in SAP

EDITED:
and yeah, run it through a For each like TomG mentioned.

You can then check if the status contains one of the numbers by using .Any() I think.
Assuming your numbers are in a list or array (or split from a text file like text.Split(vblf(0)) )

For each row In dt1
    If numberList.Any(Function(x) row("Status").ToString.Contains(x.Trim) )

vb.net way

dt1.AsEnumerable.Where(Function(row) numberList.Any(Function(x) row("Status").ToString.Contains(x.Trim) ).ToArray

which gives you an array then use a ForEach on that to process each row that contains the numbers.


#4

Hi @niteckam,

Use if condition to check the value exists in the column

Dt.select("Status in('601','610','700','710','720','730','740','750','760','770','790'").length>0

If return true -> value exists
If return false-> that value not present in the column.

Regards,
Arivu