For each row "if column b = criteria a" do ... "if column b = criteria b" do... and so on

Hi there,

I have an Excel file that has a column with three different values. I want Ui to read that value for each row. If the value is “a” I want ui to take the value from another column in that row and write it into an external program.

Right now I used (as in the attached screenshot) Excel application scope, do, for each row read cell but this doesn’t seem to be the right way.

Can you help me?

Regards.

sorry, this is the screenshot i was talking about.

  1. Create one variable with datatype string whose value you are looking for and one variable with datatype datatable
  2. Use Read range activity , store the value in output - datatable.
  3. take for each row activity .
  4. take if activity , put condition ,if it is true -
    Assign String variable = row(“column name”). tostring
  5. you will be having your desire result in string variable .
    Column name - here will be the second column whose Value you want .
    We can do this using query also . Firstly try this and let me know if you face any issue.
1 Like

@mschuler,

Try below one:

Try like this

iterate Datable through for each row
flag = 0
If row(“a”).equals(“a”)
then flag = 1
End If
if flag = 1
assign requiredValue = row("b”).Tostring
End If
End For Each

Regards,
Lakshman Ganta

@mschuler

This workflow might be what you are looking for


ReadExcelTableAndExecute.zip (9.4 KB)

This workflow will read an excel file data.
It will show the person phone number at column D if the person age above 40.
And if the person below 40 it will show the email at worksheet column C.

1 Like

Hey,
I modified this workflow and attached a screenshot. Sadly it doesn’t recognice the if … is Adressänderung -Ort- and does the else action for every row. Is the if… is… wrong?

Regards.

It think the If condition should be:
row(“ACTION /GRUND”) = “Addressanderung -Ort-”

@mschuler,

assign flag = 0
if row(“ACTION /GRUND”) = “Addressanderung -Ort-”
then assign flag = 1
end if
if flag = 1
then display row(“WERT NEU”)

I already mentioned this logic above and please check once.

1 Like