If always true

Good night people!

I’m having a problem with if inside for Aech, regardless of Boolean, it always returns the true value.

I’m using path to for aech Directory.GetFiles(“C:\Users\luan.oak\OneDrive - Solistica\Office\SIGMA CUT\BASE XML”, "" + Row.Item(“DANFE”). ToString + ".xml ")

.xml ")
my structure
XML SIGMA.xaml (12.5 KB)


Can you place a log message before Path Exists and check the value you are getting

Hope this may help you


Hi @Luan_Carvalho_Da_Conceica

It will return true always.it is coming into the loop because it matches the files with the condition you give in directory.getfiles



Obviously it will give TRUE
The reason is

  1. First you got the file paths of all files from a directory
    Which will give some number of filepaths

  2. Then we have passed the same to FOR EACH activity

  3. Inside that FOR EACH activity we are checking again whether the file path exists
    And it will exists as we are getting only the existing file and it’s filepath with Directory method

  4. So it will give only TRUE in IF condition

If we want to make it as FALSE then use a condition like this IF activity

NOT yourboolvariable

Hope this would help you resolve this

Cheers @Luan_Carvalho_Da_Conceica

Do you have any expression that can replace to get if the file exists or not?

I’m using this at the moment > Directory.GetFiles(“C:\Users\luan.carvalho\OneDrive - Solistica\Office\SIGMA CUT\BASE XML”,"" +Row.Item(“DANFE”).ToString + " .xml")

function > fetch an xml file by the reference obtained by the datetable