Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

must_include bug?

Running the following QlikView script produces an error message:

Set a = 0;

If false() then

    Set a = 1;
    $(must_include=C:\file.txt);

End if

Script Error: $(MUST_INCLUDE failed: C:\file.txt

Note that:

  • C:\file.txt does not exist.
  • When I click the error message away with "Okay", the script finishes and the variable a is set to 0.
  • When I create an empty file C:\file.txt, there is no error message.
  • When I create a file C:\file.txt containing Set a = 2; , there is no error message. The variable a is still set to 0 after running the script.

This looks as if the command $(must_include=file.txt); is not executed. Otherwise, a would have to be set to 2, when C:\file.txt exists and contains Set a= 2;. This is the expected behaviour, since none of the commands between If false() then and End if should be executed.

Still, $(must_include=file.txt); produces an error message, when the C:\file.txt does not exist, although the command is not executed. It cannot be a syntax error, since the error message is thrown depending on whether C:file.txt exists, not depending on the syntax. Is this intended behaviour or a bug? Is $(MUST_INCLUDE failed: C:\file.txt a run-time error or a compilation error?

To me it looks like a bug. The bug is a problem in a script like this:

If condition then

    $(must_include=a.txt);

Else

    $(must_include=b.txt);


End if

This script always produces an error message, when either a.txt or b.txt does not exist, even if, for the script to work, it is not necessary that a.txt and b.txt exist.

2 Replies
aftenier
Contributor II
Contributor II

estou com mesmo problema tentando usar tanto com IF, THEN,ELSE ou com SWITCH CASE...

_______________________________
Alex Foss Tenier
Consultor Qlik View / Qlik Sense
hic
Former Employee
Former Employee

The include is not a statement. It is a macro expansion.

This means that the $(...) construct is replaced by the file before the parsing of the script. It is hence not "executed" at run-time, and therefore, the If-statement is irrelevant. 

So I would not consider this a bug.