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: 
Tos
Contributor II
Contributor II

DocumentName() provide SessionApp_ Id

Hello,

i have a problem with the DocumentName() result saved to a variable. It should save the App Id and if i log it with Trace i does, but when i save the variable to a table or use it in a REST-Query, the value always appear as SessionApp_<SessionID>.

I followed the guide of How to access QRS (Repository) from Load Script. The reason i need to do this, is that i need the custom properties (maybe some additional data) for each app, which can contain the same name.

In addition i did some testing for the problem and find:

  • First try to declare the variable like the code below:
    Table tmp will contain SessionApp_<SessionId>

  • Second try:
    I reload the script. Still SessionApp_<SessionId> in table tmp.

  • Third try:
    I delete "LET vAppId = DocumentName()" and reload the script. Now table tmp will contain the App Id.

 

Code Snippet:

LET vAppId = DocumentName();
tmp:
    Load * Inline [
        AppId
        $(vAppId)
    ];

 

 

 

Your see, the problem is that DocumentName() should be in a script which will be included. That means the AppId shall be determined automatically. Does anyone has a solution for this issue or know why this is happening?

Thanks

 

Edit:
I attached a picture to show the results.

Labels (5)
2 Replies
SimonInc
Partner - Contributor II
Partner - Contributor II

Any news on this topic? We are facing the same issue and would be thankful for help 🙂

Tos
Contributor II
Contributor II
Author

I have done a workaround in this, just to store the appid information.


Let appId = DocumentName();

 

I connect via REST to the qlik sense repository which let you generate something like this.

 

RestConnectorMasterTable:
SQL SELECT
"id" AS "id_u1",
"name" AS "name_u1",
"__KEY_root",
(SELECT
"id" AS "id_u0",
"__FK_stream"
FROM "stream" FK "__FK_stream")
FROM JSON (wrap on) "root" PK "__KEY_root";

 

In the next step i use this table and rebuild with joins. In the start table i use the appId variable to restrict the results to my app.

 

app:
Load
[id_u1] as appId,
[name_u1] as appName,
[__KEY_root] as appKey
Resident RestConnectorMasterTable
Where Not IsNull([__KEY_root]) And [id_u1]='$(appId)';

 

After that you have stored the correct app id within a table.