Ui Path - If statement not working

Hi guys, I’m knew to UI Path. I’ve created a robot that goes to SAP extracts information and then saves it to a .xlsx file. If created an if statement if it finds it finds an element:

  • if it finds the element it clicks “Yes” and then closes exce (then statement)l
  • if it doesn’ find it waits (2 seconds) and then closes excel else statemetn)

For some reason I cannot understand it only executes either one… If I have files there with the same name it overwrites but if i don’t have files with the same name it glitches and doen’t do anything…

Anyone knows how to solve it?

@Lucio_Roque You don’t need to put condition like this:
Just put variable. SaveAs will be bool type.

So basically it never enters in the “Else” statement? If you look at the logs, does it ever write “New File” if it doesn’t find the popup, or it writes it and then it gets stuck later on?

@raja.arslankhan I just placed SaveAs, the “confirm save as” pop up didn’t appear and I got the Log Message - “Allow Overwrite File” which should be the case…

@Lucio_Roque
Then put “Not” before variable in Condition.

@Irene basically it only performs one of the statements either the “Then” or the “Else”. The process is just click some buttons and extract files to the a folder. The strange thing is:

  • if I don’t have any files on the folder and place the sequence that I have on right (which basically is just don’t do click the “Yes” buttom) on to the left, It writes the new files, but for some reason it doesn’t overwrites the old ones

  • If I have files with the same name on the folder (which basically just click “Yes”) it overwrites new files, but for some reason it doesn’t create new ones

Basically it only does the “Then” part either the “New File” or with the “Allow Overwrite File”

If you didn’t set a specific timeout in the “Element Exists” activity, it will wait by deafult 30 seconds before determining whether the “overwrite files” exists or not, and then it will go to the “Else” block. Did you try waiting for 30s or reducing the timeout so that it goes faster?

Also, is the output correctly set to your boolean variable ?

Hey,

Still a bit confusing, so you are saying its always running the “Then” part from If activity?
Can you put a static delay of 1s beofre element exists and then try