URGENT! PLEASE HELP HOW TO DO LOOPING IF THE DATA CONTAINS "YES" OR "NO"? CAN IT BE WITH ARRAY VARIABLES?

I have a web form like this
first I will click to click on the “Group by” form
image

After clicking on the form, data will appear like this
image

then I have an excel file containing SKU, Service columns
each column contains data like this
image

Now I want to create a UiPath flow, if the “SKU” and “Service” columns contain the value “Yes” then the robot must select “SKU” first and run another workflow. After that, the robot selects “Service” and carries out its workflow

But if the “SKU” or “Service” column contains the value “No” then the robot will not select the column containing the value “No” only executing the one containing the value “Yes”

How to create such a workflow and loop? Can I use array variables?

Hi @Kia1 , You don’t really need an array for that:

(Edit: To add the 2nd condition mentioned about the 2nd column")

  1. Use a For Each Row activity to iterate through the Excel
  2. Inside the For Each Row, insert an IF Activity
  3. Note that inside the For Each Row activity, you will be able to access each row with a default variable that the activity creates, of type DataRow, named CurrentRow
  4. Your IF Condition will be the following:
    CurrentRow("SKU").ToString.Equals("Yes") AndAlso CurrentRow("Service").ToString.Equals("Yes")
    That will return True if the text on both cells is Yes, and will return False if the text on any cells is No.
  5. Then, based on this, on the If Activity you will fill whatever actions you need, knowing it will take one path if the text is Yes, and the other if the text is No.

Hope this helps!

BR,
Ignasi

I have done the flow up to step 3

then how do I put other workflows or other sequences in the IF? Is it Then or Else?

hi,

If the condition is true the flow will go to Then block, if the condition is false it will go to else block.

Based on the condition provided by Ignasi Peiris if both columns have value Yes then flow will go to then block otherwise it will go to else block

You will go to “Then” if both cells have YES, and you will go to “Else” in case any of the cells does not contain the text “Yes”.

Check this screenshot for reference:

You need to fill inside the Then, and the Else, with whatever activities the bot needs to do in one case, or the other.

BR,
Ignasi

sorry I’ve tried it, but when it runs it doesn’t select Services or SKUs.

should I use the “Type into” activity after the form click?

Mixed up with your other topic in: PLEASE HELP HOW TO SELECTION IN FORM

You have correctly setup the decision, but now you need to teach the bot to select the desired option on each part of the IF (Then vs Else)

if both texts are Yes, you should either add a Type Into, Click, or Checkbox activity to select the option that you want, call it Services or SKU

Same for the other way around, on the Else you will have the same Type Into, Click, or Checkbox, aiming to any other case that you need

BR,
Ignasi

Yes, sorry, I replied in the wrong topic

1 Like

All good! Sorted it out :slight_smile:

I’ve tried putting my activity into Then and Else

But still the robot doesn’t run well. if you look at the data column “SKU” the value is “Yes” but the robot doesn’t choose “SKU”

Would you mind attaching your code here, so I can take a look and understand better what you have currently?

@Kia1

Did you check if multiselect item activity is identifying the selector if yes…then you can directly use it

Cheers



my UiPath flow is like this

I understand that you need to select the SKU Option, correct?

If so, you are using the wrong data in the Type Into, as CurrentRow(“SKU”) Will write “Yes” on your filter, instead of SKU, as this is the value coming from the excel.

Since you want to write “SKU” instead of “YES”, you should not use CurrentRow variable.

Inside the “Then” segment, we know that both SKU and Service Contain a Yes, therefore I’d have a sequence with the following:

1- (Already done) - Navigate to the Then by having both values set as Yes
2- Type into filter “SKU” and click on it
3- Clear Filter Text and write “Service”, then click on it

This way when both of the values in the excel are Yes, the bot will select them both in the list.

Hope it made sense :slight_smile:

  • If you can send us the zipped code, we might be able to help a bit more, can be done by Zipping the project folder and uploading it from here:

image

BR,
Ignasi

Sorry, I can’t share zip files, because there is some private data

I’ll try to improve it again, maybe you have a similar project to me?

Thankyou