Selecting a row based on multiple attributes

Hello,
I have a data with sku code and pack types. In a for loop, I need to select row what’s in the my data on this web page.

I can get row number with get attiribute but I don’t get with the second condition (pack type)

@bagcivan
In “For Each Row” use “Get Row Item” activity → Which gets the DataRow value according to specified column.

Hi

May be we can do in other way
Like first get that table from that application using DATA SCRAPPING which will give us a output of type datatable
Save that as dt

Now in dt we can get the row we want with the condition we want to apply by just using a for each row activity with a if activity inside it

@bagcivan

1 Like

Hi @Karuna
Thank you for your interest.
There is no problem getting data from excel file. According to the data i got, I cannot select the right row on the web page.

@bagcivan
the selector to Standart has defined the idx=‘1’. But it looks like you want to click on 2nd Standart row. Also with with innertext='460… the selector is bound to first standart row.

It is depending on how you will decide, which row is to click. In general we do have tow options in place:

  • datascraping and calculating the index. The calculated index you could e.g. use by
    <webctrl tableRow='{{YourIndexVarAsStringOrInt}}' .... />

  • find children approach

@Palaniyappan @ppr

yes, I will try to use the data scraping and finding which line(tableRow) to click check.

It like seems, we cannot get attributes from two grids at the same time.

@ppr Also, how are we going to use find children in this case? Can you help me about this

For an idea
Here you go on how to use it

Cheers @bagcivan

set the selector to the table
set filter to <webctrl tag='TR' />
Scope: Find_Descendants

so we wouldretrieve all table rows and can process it further if needed. In a lot of scenarios we can do it with help of LINQ.

Can you please elaborate on this?

@ppr This is my data.
2021-09-14 13_38_14-packlist.xlsx - Excel

flowwork
[web page activities]


after that

  1. I’m getting the my data with read range
  2. Add for each row
  3. Assigning sku code and pack type to variable

now we have two variables;
for example
Sku Code = “W4601ASINAXXL”
Pack Type = “Standart”

according to these conditions i have to click check 2nd line in webpage,

next

Lets assume following: variables with no spaces In the name of datatype String

SkuCode = “W4601ASINAXXL”
PackType = “Standart”

Following selector

<html .......
<webctrl tag='TABLE' parentId='LotCodeList' />
<webctrl tag='TD' innertext='{{PackType}}' tableCol='9' />
<nav up='1' />
<webctrl  tag='TD' innertext='{{SkuCode}}' tableCol='4' />

ensure that the variable has valid default values, then we can test and evaluate the selector
check if the tableCol indexes are correct as we do see 4, but in screenshot it is the second Col
adopt it if it is needed

then the bot should click on the first row matching the corresponding variable values

Also have a look here.

@ppr I couldn’t find the element when I tried without using variables with this method

Confused by your screenshot as it was not trying the suggested approach? So what was done so far in detail?

There are some hidden columns. It looking when we get it with data scraping. Therefore, sku code ise 4.

ok fine, if TableCol are ok , thw use it. So now try the selector as described above. First line (parnet selector) take it as it is

Choosing row 2, instead of row 3 :thinking:

kindly note you have used nav-up=‘2’ thats why you jump up to other SKU

<nav up='2' />

I don’t know exactly what this line does.

what is the role of nav

its an integrated aanchor
it jumps to a particular PackType td
Jumps up an element to parent tr
Enters td SkuCode

But if things are unclear please do not change suggestions, thanks

When i set nav=1, it selects the residue line this is ok but when i change the pack type, it still gives an error.

we always need to know which error. Lets assume it is not vlaidating check if the default values from the variables are matching pair and reflecting the test case