If activity string variable condition

Hi,

I’m using an IF activity to find out if the data scraped excel sheet name is like “BP” or not . If the sheet name is BP then the robot will perform some actions else it will perform something else. Before the IF activity I used a Get Full Text activity to extract the sheet name as a string variable. I’ve confirmed that the extracted value is “BP” so I don’t understand why the sheet name variable condition in the IF activity is failing as it always goes down the else path.

Regards,

Jeff

Hi,

First, can you try the following step to check content of SheetName variable?

  1. Set break point at If activity.
  2. Run Debug or Debug File.
  3. It will stop at If activty. Then check content of SheetName variable at Locals panel.

Regards,

Hi @JeffNZ1,

You can also use log message activity to print value of get full text before If condition.

First of all debug and check the SheetName value in runtime.
Use below method in the if condition-
SheetName.Trim.Contains(“BP”)

As you are using Get Full text method its more prone to get junk values along with “BP”.

You should be using Get Workbook Sheets to get the sheets (and their names).

2 Likes

Hi @JeffNZ1 ,

As @postwick suggestion you can use Get workbook sheet

  1. Get workbook sheet → Create a Variable(Type : List of String)
  2. For Each item in Variable(Type : List of String)
  3. If item = “BP” then your process else other process

Thanks Paul appreciate the advice cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.