Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
wcoleman0908
Partner - Contributor III
Partner - Contributor III

$(Must_Include) Not loading variables into the App read from a file

For whatever reason I'm missing what the possible issue might be. My task is to create a file defining variables I want loaded into the App. (QlikSense) November 2022 release

I'm building the file via an App that does the following:

Build_Include:
NoConcatenate
Load distinct /*** Build the links ***/
ObjectId,
SheetId,
'Let v' & Dashboard & '_' & [Sheet Name] & ' = ' & Chr(39) & '$(vServerName)' & ObjectId & '/sheet/' & SheetId & Chr(39) & ';' as Global_Include_Links
resident XXXXX

DROP Fields ObjectId, SheetId from Build_Include;

STORE [Build_Include] INTO [Lib://Folder1/Global_Variables.txt] (txt);

The data in the file looks like this when i view Global_Include_Links it in a sheet:

Let vDashboard 1 = 'https://localhost/11111111111111/sheet/555555555555';
Let vDashboard 2 = 'https://localhost/12121212121212/sheet/444444444444';
Let vDashboard 3 = 'https://localhost/13131313131313/sheet/666666666666';
Let vDashboard 4 = 'https://localhost/14114141414141/sheet/456456456456';

I attempt to load it using the following script:

$(Must_Include=[lib://Folder1/Global_Variables.txt] (txt);

No errors and Afterword's, i look at the app variables and the 4 don't show.

Can anyone see what I'm missing here?

Thanks in advance.

Labels (1)
15 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

The text file that you are storing, includes additional information, such as ObjectId and SheetID, and those multiple fields are separated by commas (by default). 

 

So, the Must_include command includes the complete text to your script:

<ObjectID>, <SheetID>, Let vDashboard 1 = 'https://localhost/11111111111111/sheet/555555555555';

etc...

So, this is not a valid script syntax. I'm surprised that you don't get any errors on those, but I think your variables cannot be populated this way. You should try storing the LET commands without the extra fields - that way it might actually work.

ckarras22
Partner - Creator
Partner - Creator

Hello,

It might be that yiu have forgotten the ending parenthesis 

 

$(Must_Include=[lib://Folder1/Global_Variables.txt] (txt));

 

Christos

wcoleman0908
Partner - Contributor III
Partner - Contributor III
Author

in the example script i removed the two fields you mentioned before storing the file as shown.

DROP Fields ObjectId, SheetId from Build_Include;

wcoleman0908
Partner - Contributor III
Partner - Contributor III
Author

I added the paren but still NG, 😞

this is the error i'm getting..


The following error occurred:
Unknown statement: "'Let v' & Dashboard & '_' & [Sheet Name] & ' = ' & Chr(39) & 'https://localhost//sense/app/' & ObjectId & '/sheet/' & SheetId & Chr(39) & ';'"
"Let vDashboard 1 = 'https://localhost//sense/app/11111111111111/sheet/555555555555';"
"Let vDashboard 2 = 'https://localhost//sense/app/12121212121212/sheet/444444444444';"
"Let vDashboard 3 = 'https://localhost//sense/app/13131313131313/sheet/666666666666';"
"Let vDashboard 4 = 'https://localhost//sense/app/14114141414141/sheet/456456456456';"

 

ckarras22
Partner - Creator
Partner - Creator

This is strange, although you have included the underscore _ in the load "...Dashboard & '_' & [Sheet Name]... ",  it doesn't appear in your output and that might be an issue

Could you please attach the txt to see how it is formed?

 

wcoleman0908
Partner - Contributor III
Partner - Contributor III
Author

I added a replace statement on the dashboard field from ' ' to '_'..... still very painfull. I'm sure its something stupid. It might be the double quotes in each statement only i'm not sure how to remove them.

Unknown statement: "'Let v' & Dashboard & '_' & [Sheet Name] & ' = ' & Chr(39) & 'https://localhost//sense/app/' & ObjectId & '/sheet/' & SheetId & Chr(39) & ';'"
"Let vDashboard_1 = 'https://localhost//sense/app/11111111111111/sheet/555555555555';"
"Let vDashboard_2 = 'https://localhost//sense/app/12121212121212/sheet/444444444444';"
"Let vDashboard _3 = 'https://localhost//sense/app/13131313131313/sheet/666666666666';"
"Let vDashboard_4 = 'https://localhost//sense/app/14114141414141/sheet/456456456456';"

vinieme12
Champion III
Champion III

Just below without (txt)  ;  also try to run in DEBUG mode to confirm if the file is being read

 

$(Must_Include=[lib://Folder1/Global_Variables.txt]) ;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
marcus_sommer

AFAIK you couldn't prevent the auto-quoting by storing any content containing quotes within a txt-file. But you don't need them because instead of using LET you could apply SET which didn't evaluate the statement else just taking the content as string.

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

I know that you can set certain parameters along with the qualifier (txt), and one of them might be quoting=none, like this:

STORE ... (txt, quoting=none)

I never used it myself, but it might work...

However, I must admit that loading variables this way is certainly over complicated. As an alternative, you could load the same values into a usual table and then load them into variables using the function Peek().

Rob Wunderlich covers this technique in his Scripting session at the Masters Summit for Qlik, and I am describing it in detail in my book QlikView Your Business.

Cheers,