Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro always return 0

Hello Expert,

I am calling one function from script. The macro function is very simple:

public function checkFile(filePath)

          Dim findFile 'as Boolean

          Set objFSO = CreateObject("Scripting.FileSystemObject")

 

          If objFSO.FileExists(filePath) Then

         Call objFSO.DeleteFile(filePath)

                    findFile = 1

          Else

                    'Set objFSO = nothing

                    findFile = 0

          End If

          checkFile = findFile

end function

In the scrpit, it was triggered as:

let a = checkFile('$(filePathOfCurrentLoad)');

if $(a) = 1 then

          let b = '';

else

          let c = '';

endif

The confusing issue is, if the file is in the place of variable filePath, it got delected. However, no matter the file is there or not, the function always return 0.

Any suggestions?

Many thanks

HTC

0 Replies