How to get datatable row count based on specific row value

I have extracted data table with 2 rows. So by using currentrow(0).tostring I am getting first row first column value.by using this row value I need to get table row count from where this value is present in which row. Based on table row count need to select check box matching to that value.

Please help anyone?

can you try this once
datatable.AsEnumerable.ToList.FindIndex(Function(a) a(“CloumnNmae”).tostring.equals(“your required value”))

sounds like you are more interested on the row index of each row, holding the the first row, col(0) value. Can you confirm and also maybe share some sample values with us? Thanks

Hi @vnsatyasunil,
Based on your input seems you’re getting the value through For Each. So you can use the Row Index property of For Each activity. You can solve this problem with Row Index value.

0 output coming but I have required value in 3rd row

can you share a input image and required output so that it will help me to solve me out

In website required value can be found in different rows. In extracted data table we have row value. So we have to check that row value in website in which row it is found & get that table row number to select the check box dynamically beside row value column

can’t share the image
but in portal I have 5 columns. First column is check box so I extracted other 4 columns to data table. Then filtering based on the status (yes/no) value. If status column is having no value then those rows which has no value need to be checked in check box in portal

@vnsatyasunil

Then it would be ideal to get the row selector and use a dynamic selector to select the row based on the value from the datatable

Insicate the check box and you would have mostly a tr tag also from The centre menu in the ui explorer window

Eg:

 <webctrl tag='TR' innertext = '*{{varconcatenatedrow}}*' />
<webctrl tag='td' tablecol = '1' />
<webctrl tag ='DIV' />

Here last div is for exact check box td is for the column containing the check box and tr is the whole row containing the required data…and varconcatenatedrow is the variable which contains the data in same format as see in the innertext generally currentrow(0).ToString + " " + currentrow(1).ToString etc - this depends onhow the innertext looks in the ui explorer

Cheers

above mentioned is one option

another option is:
Assign activity:
arrIDX | int32 Array =
(From i in Enumerable.Range(0, YourDataTableVar.Rows.Count)
Let v = YourDataTableVar.Rows(i)(YourColNameOrIndex).toString.Trim
Where v.Equals(YourCheckValue)
Select x = i).ToArray

then loop over arrValue and use the index within a dynamic selector

when I click check box selector is like this
selectorvalue

aaname & inner text not coming in ui explorer. In table row if I pass row count it will work right?
In this table row=4 means 4th row

@vnsatyasunil

Ideally it would work…

In ui explorer please check the tight top menu…where you would see othe rattributes present of rthe selector

You need to explicitly select them

Cheers

selectorvalue

in this table row=4 If we pass row count of that required value it will work right?

@vnsatyasunil

Not the row count but the row index…but rowindex will start from 0 so may be it is important to add 1…

Also if you are filtering the data after scraping the row indexes might change…

You can try using for loop on orginal table and use the for loop index property to get the correct index

Or get the rowindex from original table after filtering

Cheers

You can use a counter a well inside the loop if row index property is not working

selectorvalue

in this table row If we pass row index of that required value it will work right?
like can we check particular extracted value in the website and get the row index?

@vnsatyasunil

Yes you can sue get attribute to get the required row index from website and pass it

cheers

Hi @vnsatyasunil

Try this-

  1. Extract the data table with two rows using the required method or activity.
  2. Loop through each row of the data table using a “For Each Row” activity.
  3. Inside the loop, check if the value of the first column in the current row matches the desired value. You can use an “If” activity for this comparison.
  4. If the value matches, store the row index in a variable. You can use the rowIndex variable of the “For Each Row” activity for this purpose.
  5. After the loop completes, you will have the row index where the value is present.
  6. Use the row index to select the checkbox associated with that value. You can use a “Click” activity or any other appropriate method to interact with the checkbox.

Thanks!!

Hi. I tried it. But row index is getting wrong.
In website I have 20 rows for example. After extracting & filtering I am getting 2 rows data.
These 2 rows data I need to check in website & get the row index & pass in the checkbox selector to check those 2 rows

used for each row in webpage extracted data table. In another data table output I have filtered data
Then used if condition for 1stvalue it is fine but for 2nd value failing.
how to pass expression in if condition.
currentrow(0).tostring=filteredDT.Rows(0)(“Columnname”).tostring
here how can we get every row from filtered data table to check with currentrow(0).tostring
Please help?