Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Peony
Creator III
Creator III

Error while using Wildmatch() and If()

Hi all. 

At the beginning of the app I want to call subroutine if documents name are contained particular word. 

I tried this code

If(WildMatch(DocumentTitle(), '*Input*'), Call Input_Sub);

And got this 

sub.png

Can't get what's wrong with the syntax. Can someone explain please? 

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar

You cannot call a subroutine inside a load statement. That's all. If you want to check the name of the document and based on that call a subroutine you shouldn't use a load statement, but something like:

For Each vFile in FileList('C:\Mydocs\*')

    If WildMatch('$(vFile)', '*Input*') Then

        Call Input_Sub

    EndIf

Next


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

You cannot call a subroutine inside a load statement. That's all. If you want to check the name of the document and based on that call a subroutine you shouldn't use a load statement, but something like:

For Each vFile in FileList('C:\Mydocs\*')

    If WildMatch('$(vFile)', '*Input*') Then

        Call Input_Sub

    EndIf

Next


talk is cheap, supply exceeds demand
Peony
Creator III
Creator III
Author

I got it. Thank you mach GysBert for the help and explanation.