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: 
flo2
Contributor III
Contributor III

Store values of variable in qvd

Hello all,

I would like to keep track of some variables that I calculate thanks to set analysis.

( My idea was to store the values  of the different variables in a QVD with a  column for each variable and everytime i reload it adds the new values of the variables inside the qvd as a new line. Also when  I reload it import the previous values of those variables to make an historical data graph )

So there are a lot of topics on these subjects ( like this one https://community.qlik.com/t5/New-to-Qlik-Sense/Incremental-Load-on-QVD/td-p/1309066

But It appears that i don't fully understand.

Because what I did was:

1) Declare the variables ( I was not sure if I had to put an equal sign  or not inside

 

Let v_indic_1 ='count({(1<[field ]={"fvalue"}>+.... ])';

Let v_indic_2 ='=count({(1<[field]={"value "}>+1<[field]=] .... )';

 

 

2) Load previous values of variables inside the qvd and concatenate with the new ones then store all in the qvd.

 

ALOS:
LOAD v_indic_1,
v_indic_2,
v_indic_3,
v_indic_4,
v_indic_5
FROM
[...\ ALOS.qvd]
(qvd);


concatenate

Load
'$(v_indic_1)' as v_indic_1,
'$(v_indic_2)' as v_indic_2,
'$(v_indic_3)' as v_indic_3,
'$(v_indic_4)' as v_indic_4,
'$(v_indic_5)' as v_indic_5
AutoGenerate 1;


Store ALOS into [ALOS.qvd] (qvd);

 

That works but it stores the text of the formula inside the qvd and not the values of the variables.

I tried also without the ' ' to load the new values of variables ( '^(v_indic_5)' as v_indic_5...

If someone has an idea that would be with pleasure to listen 🙂

thanks for reading !

 

Labels (4)
16 Replies
flo2
Contributor III
Contributor III
Author

Thanks, it seems very complex, i was searching about examples of  these kinds of solutions on community.qlik and it seems pretty difficult.

Would it be possible to, instead of keeping tracks of former and current values of variable, to keeping track of the former values of text objects ?

I mean, I would not not store the values after reloading of the values of text object but I would store the value before the reloading.  To do this, I  would store in a qvd file the current values shown in the app in these text objects ( not the values after the reload but the value before the reload )

I was thinking about using macro at the opening maybe ? ( i have to check if it will work even for app in access point ) to be able to export directly values of text objects to qvd files ( so the values before reloading cause if I understand well it will be very complex to have the values after loading ) 

marcus_sommer

Nearly each object could be exported. By a text-box I'm not sure if qvd as file-format would be possible whereby why not just taking a table-chart? It could be used for multiple variables and also contain further columns for a name, comments and other stuff.

Important is such macros/actions are only possible if the document is opened - within the desktop client or the IE plugin because within the AJAX client the most macros aren't possible respectively have other restrictions (by server-side macros).

What is the aim behind all this? Why should the next reload loading any UI stuff from the application?

- Marcus

flo2
Contributor III
Contributor III
Author

About the aim behind this it is that currently my Qlikview app calculates five KPI ( before it was KPI calculated thanks to set analysis on UI but now i converted them to script variables that i display on text object ) 

So there are these 5 KPI that I would like to keep a trace of,  i mean keep the old values of them and do a graph about the evolution of them.

So I wanted that at each reload of the app the values ( or script variables or value of text objet where the kpi are displayed ) are writen in a qvd file.

Also at each reload it loads the data of the former values from the qvd.

And so, with the potentiel restrictions i think it won't be possible with macros but i'm going to search some possibilities

 

marcus_sommer

If I understand your description right then happens the KPI calculation further within the UI - only string-variables are used as expression instead of a manually written expression? Because if these KPI would be directly calculated within the script you could easily store them from there as qvd.

Have you ever considered to do these calculations within the script? If this should be really not possible I would repeat my suggestion from above to investigate if a write-back approach could be implemented.

- Marcus

flo2
Contributor III
Contributor III
Author

Ah ! I think i didn't understand well your previous response because of my poor english 😁

Because i thought that even if I did the calculations in the script i couldn't make write the values in a QVD file

I tried like that :

let var_prom = count(if(match([Intern step],'...',1,0) and match([formular],'...',1,0) ,1));

/*
ALOS:
LOAD 
promEmbaucheChiff1
FROM
[ALOS.qvd]
(qvd);


concatenate (ALOS)

*/ 
ALOS : 
Load
$(var_prom) as promEmbaucheChiff1
AutoGenerate 1;

Store ALOS into [ALOS.qvd] (qvd);

 

( the ALOS.QVD is the QVD where i would like to put the values of the variables.

I concatenate the data  to have the old values and the current values )

 

But i have an error, i think it doesn't recognise my expression for my variable . I have a Syntax error when i try to use the variable with $(var_prom)

Syntax error
ALOS :
Load
as >>>>>>promEmbaucheChiff1<<<<<<
AutoGenerate 1

 

Because var_prom is a KPI i would like to put in a QVD file.

marcus_sommer

Like above already mentioned such a calculation couldn't be done within a variable in the script. You need to create a table (pulling all relevant fields together and applying the needed transformation and aggregations) which may end in just a single row + single column = single value - which may then be stored within a qvd or also assigned to a variable.

- Marcus

flo2
Contributor III
Contributor III
Author

It was indeed as I said my bad understanding of english, thanks a lot it works !