Support Portal

for ProcessRobot and WinAutomation

Start a new topic

IF Statement - can't compare General and Text Value

I am trying to work out how to use a AND if statement, 


This is my logic:

First Operand: %IsUKBankHoliday == "Yes" && IsIrishBankHoliday == "Yes"%

Operator: =

Second Operand: True


I am getting the error: "Cannot compare a general value and a text value"


The %IsUKBankHoliday% and %IsIrishBankHoliday% values are obtained using a Read From Excel Worksheet action.  My Excel worksheet calculates if today's date is a BH in the UK and Ireland and stores the words Yes or No in cells B2 and B3. (one per country)


The statement works if I manually use Set Variable actions and hard code them in as "Yes" - this causes the variable to change to a Text Variable. But reading from Excel causes them to be General Variables.


Can anyone help? 

Ultimately there will be four paths the bot may go down, BH in both areas, BH in neither area, BH in UK only, BH in Ireland only, 


If i can't use 4 individual If statements, could I use a switch? Unsure if i would have the same issue though comparing a General Value to Text?


Thanks


Can you show screen shot of your code?

I have fixed this now by setting the 2 variables to a default of "Yes" before the executing the Read From Excel File action. This causes the two variables types to be set to Text in the console prior to any code running which makes the red X error dissapear so the code will run!


When the Excel file content is read, the two values are then just updated to the real values. 


Seems a bit silly that I had to do that, but i'm finding WA to be quite flaky and inconsistent, I find my bots seem to fail some days and work perfectly on others! For example, This particular bot retrieves the last working date from an Excel file / works out if it is a bank holiday. Then depending on BH instances for UK / Ireland / work date in month, calls a few secondary bots and passes the lastworkdate variable to the processes (using the %ext:% method.


Today, it sent the date as 15/09/2020 to one process, and 30/09/2020 to another! - causing my bot to trigger an incomplete report due to the 2nd bot timing out waiting for data to load for 30/09/2020 - which obviously is a date in the future! Just makes it awkward explaining to the client each time it fails for strange reasons! I have another issue now, will raise new post - relating to a file path not being found - works fine when i am logged in and manually run the process, fails when i put it on a schedule and log off to let it run!

Andrew,
In contrast to your experience, use wa's big brother, processrobot (built on common engine of WA), every day for enterprise automation and it is stable.  Only coding issues or changes in web site could effect execution that your experiencing.

Forum users, would need to view your code to advise on how to tighten up your date processing.  Perhaps you can upload the waj file here, so all can advise or screen shot it and paste it here.

You need to keep the machine running, but you can logoff or lock the screen.  For autologin to work on schedule from a log off  of windows (but machine or virtual machine must be left running), you must setup autologin in general screen and enter your windows password to save it for autologin to use.


image



image


Login or Signup to post a comment