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
wcoleman0908
Partner - Contributor III
Partner - Contributor III
Author

I seem   to be blind here, it shouldn't be this hard to build and read a file for the purposes of building a master include file file for developers to utilize. I'm attempting to build the Let statement needed in the script once the Must_Include is called. I'm including a sample App if anyone can please fix it so  can make this operational.

Now i'm getting this:

The following error occurred:Unknown statement: LINK"vDashboard_1_Sheet_1 = 'https://localhost/sense/app/123456789/sheet/987654321';""vDashboard_2_Sheet_2 = 'https://localhost/sense/app/34567898765/sheet/7654329';""vDashboard_3_Sheet_3 = 'https://localhost/sense/app/76543456789/sheet/3215678';""vDashboard_4_Sheet_4 = 'https://localhost/sense/app/765344566789/sheet/32151111678';"

Missing the 'Let' statement 😞 .  Any help on this would be greatly appreciated.

Sample App is included

Thank y'all

wcoleman0908
Partner - Contributor III
Partner - Contributor III
Author

If you could be so kind, It might be easier to look at the sample app I posted to see for yourself.

The variable should be the name of the 'App_Sheet'  the link points after the 'Must_Include' runs. Here were just dynamically loading the current data instead of manually updating linked variables in the Apps. There could be many different uses for this functionality moving forward.

This would be the desired results needed for the must include to actually work.

Let vDashboard_1_Sheet_1 = 'https://localhost/sense/app/123456789/sheet/987654321';

This is what's not cooperating. 😞 

marcus_sommer

Currently I have no Sense available and could therefore not look into your application.

Beside this make at first sure that your variables are working - means not outsourcing them in txt-files and loading them per include() else defining them directly within the script. At this point they must be working. The outsourcing is later only cut & paste in a txt-file and specifying the source within the include-statement. Often it's helpful not to develop the logic and syntax within the origin application else preparing a small dummy app with just a few records and objects to perform the development in a real-time mode.

wcoleman0908
Partner - Contributor III
Partner - Contributor III
Author

Yes I did test that process. I loaded the TXT file into Qlik and built a sheet that shows the data. Then downloaded to  excel and copied the Let statements into the script and loaded them successfully. Then checked the variables created by the load and they appeared and created valid links.

I still can't believe that it can be this difficult, Any help is very appreciated.

Thanks team

marcus_sommer

It's still not really clear for me what do you do and where and why it behaved differently to your expectation.

At first storing the variables from Qlik into a txt-file could work but as far as quotes are included it won't work - at least not without an external preparing because all quotes will be automatically quoted during the store-process. Important by such an approach is that only the variable-field is included within the store and that the field is named as a valid Qlik statement, for example like:

t: load var1 as [set dummy = dummy;], var2 inline  [
var1, var2
set var1 = www.google.com; , www.google.com
let dummy =; ,
];
store [set dummy = dummy;] from t into t.txt (txt);

let var2 = peek('var2', 0, 't');

drop tables t;

$(must_include=[t.txt]);

Further important is give attention to the differences of LET and SET - means is the variable-content is evaluated at first and only the result is assigned to the variable or just the content is taken as string.

The above example contains now two approaches - one is storing the table as valid Qlik statements within a txt-file which is later taken as include-variable and the another is to skip this storing-part and to assign the variable-values per peek() to a variable.

Regarding to your origin description I would probably go with the peek() approach - within an include-variable. This means the first load to combine multiple field-information within a table would be already outsourced together with a loop over the table which fetched the variable names and values and assigned them appropriately.