Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
souadouert
Specialist
Specialist

filetime function

I used filetime function with qlikview MACRO to test the file exist

if isnull(filetime("D:\MACROTEST\VISION1.csv")) then

msgbox("")

else

sgbox

end if

and i have this error Type mismatch: 'filetime'

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Souad,

You can also try

Sub Test

Set FSO = CreateObject("scripting.filesystemobject")


If  FSO.FileExists("D:\MACROTEST\VISION1.csv") = true Then

  Msgbox "Yes"

Else

  Msgbox "No"

End If


End Sub


Note: You need to enable "Allow System Access" option in the current local security.

View solution in original post

5 Replies
sunny_talwar

May be try something like this

vFileTime =  ActiveDocument.Evaluate("If(IsNull(FileTime('D:\MACROTEST\VISION1.csv')), 1, 0)")

If vFileTime = 1 then

msgbox("")

else

sgbox

end if

CarlosAMonroy
Creator III
Creator III

Hi Souad,

I have tried FileTime() and it works fine. Would be good if you share a sample file.

Otherway you can try using other functions like:

     if len(FileSize('file_name')) > 0 THEN

     ...

     ELSE

     ...

     ENDIF

Hope that helps,

Carlos M

tamilarasu
Champion
Champion

Hi Souad,

You can also try

Sub Test

Set FSO = CreateObject("scripting.filesystemobject")


If  FSO.FileExists("D:\MACROTEST\VISION1.csv") = true Then

  Msgbox "Yes"

Else

  Msgbox "No"

End If


End Sub


Note: You need to enable "Allow System Access" option in the current local security.

tamilarasu
Champion
Champion

Hi Sunny,

Hope you are doing good!

I think FileTime function in macro does not work. I believe only chart functions (not script functions) can be evaluated through macro.

You can try any script functions inside the below syntax and you will see "Its not a valid function" error message.

Msgbox  ActiveDocument.Evaluate("Any Script Function")

sunny_talwar

Make sense... I used a chart function before like that, so I thought this might work as well . Thanks for pointing it out tamilarasu