Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
clarcombefmsb
Contributor III
Contributor III

Loading all fields to Qlik variables via Excel

I would like to not only load variables via an excel file, but also add tags and descriptions
 
How should we specify the load expression 
 
Variables_Labels:
// Load Variables from Variables tab

Load
    Name
    ,Expression
    ,Comment
    ,Description
    ,Tag
FROM [($vManual)variables.xlsx]
(ooxml, embedded labels, table is [Variables-Labels]);


// Loop to generate a variable for each variable in the list

For i = 0 to NoOfRows('Variables_Labels') -1

      LET Name = text(Peek('Name',$(i),'Variables_Labels')) ;
      LET Comment = text(Peek('Comment',$(i),'Variables_Labels')) ;
    LET Description = text(Peek('Description',$(i),'Variables_Labels')) ;
    LET Tag= text(Peek('Tag',$(i),'Variables_Labels')) ;
      LET '$(Name)' = text(peek('Expression',$(i),'Variables_Labels'));

Next i
In the Let '$(Name)', how can we load the previous assigned variables of Tag Description etc to the variable ?
 
This is my Excel file
Name Expression Comment Tag Description
vlLanguage =IF(vLang='FR','Langue','Taal') Language Label Language Represents the language in which the document or information is written or communicated.
vlDocumentname =IF(vLang='FR','Nom du document','Documentnaam') Documentname Label Documentname Refers to the name or title given to a specific document or file.
 
 
Thanks

 

 

 

 

 

Labels (3)
1 Solution

Accepted Solutions
marcus_sommer

AFAIK a variable has no TAG property (only fields and tables have it). A COMMENT property exists but it's not available from the script else only from the UI. In QlikView the variables-comments could be read/write per macros. In Sense it should be also possible with any API but I don't know which and how.

Beside this you may load your Excel directly within the data-model and providing the information in a table to give the users additionally insights.

View solution in original post

3 Replies
menta
Partner - Creator II
Partner - Creator II

Let vVariable_Name = Peek('Tag',$(i),'Variables_Labels'));
Let $(vVariable_Name) = text(peek('Expression',$(i),'Variables_Labels'));

clarcombefmsb
Contributor III
Contributor III
Author

Thanks for the reply. Unfortunately that doesn't work. The Tags and Description are still empty in the definition when I reload

clarcombefmsb_0-1684227838563.png

 

marcus_sommer

AFAIK a variable has no TAG property (only fields and tables have it). A COMMENT property exists but it's not available from the script else only from the UI. In QlikView the variables-comments could be read/write per macros. In Sense it should be also possible with any API but I don't know which and how.

Beside this you may load your Excel directly within the data-model and providing the information in a table to give the users additionally insights.