Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
OmarBenSalem

changing variable values in the front end to use in the script

Hi all, stalwar1

I'm using QLIK SENSE (not qlikview)

I want to do this :

1) I have a variable : let's call it vTest. It's created in the front end.

2) I want to have an input box in which I can enter a new commentary and thus edit the value of the vCommentary variable.

For this, I've used this extension:

Qlik Branch

3) Now I'm able to define my new variable and show that I can use it in a table for example; it does change; it's obvious in this table below:

Capture.PNG

4) Now I want to stock these 2 variables into 2 fields and store them into an external file:

var:
Load
'$(vTest)'  as Commentaire,
'$(vIntervenant)' as Intervenant
AutoGenerate(1);

store var into [lib://test/Nouveau document texte.txt]
(txt);

This won't work BECAUSE, when I change the variable value using extensions, I does not change here :

Capture.PNG

My question is HOW TO DO THIS?

How to make my change persist? I can see that the variable has changed in my table; but the change is not written within the variable so I can't use it in my script!

Is there a way to do this?

modifying a variable value in the front end in a sort an inputBox and use this variable in the script?

Second question:

Is it possible to store a table from Qlik Sense into a database table?

sthing like this:

store var into [lib://test/Nouveau document texte.txt]

(txt);

but in a database not a file?

11 Replies
OmarBenSalem
Author

OmarBenSalem
Author

Anyone? Please

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Omar,

I would speak to the people who have created the extension.  I would have thought given the Sense API they would be able to overwrite the variable value properly - but there may be a technical issue why they can not.

Taking input from an input box and writing a variable from it would require an extension, you may be able to modify the one you have downloaded, or find someone who can, but it is not necessarily going to be straightforward.

Again, you should be able to build (or find) an extension that will export a Sense table to a file, but it is not something I have done previously.

To do something in the load script is relatively straight forward, so if you have these data:

Data:

LOAD

     Dim1,

     Dim2,

     Value

FROM lib://Data/Source.qvd (qvd)

;

If you wanted to have the Value by Dim1 in a table you could do:

ExportMe:

LOAD

     Dim1,

     Sum(Value) as Value

RESIDENT Data

GROUP BY Dim1;

STORE ExportMe INTO lib://Output/MyFile.txt (txt);

DROP TABLE ExportMe;

The expressions can go beyond a simple Sum to being whatever you need to do.  It will be problematic if you have data from different tables though.   You will need to join these in the load script to be able to do calculations over them.

Hope that helps.

Steve

OmarBenSalem
Author

Thank you Steve for the quick reply.

My second question was about storing a qlik table into a DATABASE TABLE.

How to do this?

I can directly store it into a txt file or a qvd:

exp:

Capture.PNG

but I don't know how to do it in a db table .

Why to do this? I want to be able to store all the commentaries that would be written by the users into  a db table..

OmarBenSalem
Author

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

This is certainly not something that Sense will do natively.  It is unlikely you will find an extension to do it either.

You may be able to do something where you write an interface file (csv/txt) and then use a database import tool to bring it in.

OmarBenSalem
Author

mto‌, icd ,  can you help with this please?

Ian_Crosland
Employee
Employee

The only native supported export capabilities for Qlik via the store command are QVD and text no options exists to take data from Qlik and populate a database its not the sweet spot for Qlik.  Searching for SQL Writeback capabilities within the community will yield custom solutions for this question.

OmarBenSalem
Author

Thank you for the as always quick response IAN,

what about the first and main question? How to force a change of the variable value? I don't know if you've seen the example I've put in my first post ?