Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
mauvasco62
Contributor III
Contributor III

Loading data using a variable input

Hi all,

i created a variable called 'vDataInput' and i configurated it in a variable input

Now i would like to load using the variable input.

I suppose that the script is load * from table where date(DATA_INIZIO_VALIDITA,'DD/MM/YYYY') = date('$(vDataInput)','DD/MM/YYYY') but it doesn't works.

Please help me 

Thanks Mauro

Labels (2)
5 Replies
marksouzacosta

Do you have any error message, or the data is not returning as expected?

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

Corona55
Creator
Creator

As mentioned above, are you receiving any errors? I'd suggest adding a trace statement in your script to check the value inside vDataInput. 

Trace vDataInput: $(vDataInput);

you might also need to use the Date# function take the text string to a numerical date. you can check by adding another variable in the script:

let vDataInput2= Date($(vDataInput), 'YYYY-MM-DD');

Trace vDataInput2: $(vDataInput2);

That'll let you if you need to convert the text to dates. 





Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

HI @mauvasco62 ,

In my opinion you will not get consistent results. I presume you are using Qlik Sense. The variable input is a "session object" and value held in it can be different for each and every user depending on what they choose. When reloading app variable value will not be picked up from your session, instead default value of variable will be used (if you have set any). Now I noticed that this works different if you use Qlik Sense desktop, it works different when you reload from your work stream and also works different if you reload from published stream. In a nutshell it may as well be dependant on the ownership of the app, but I am not sure about it and i have not found whitepaper explaining how this will work.

If there was consisten solution for this you could think about creating sort of write back solution which frankly i was never able to succesfully implement using such approach.

Now here I would ask someone who knows more about this staff for opinion - @marcus_sommer  @hic 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
hic
Former Employee
Former Employee

Using a variable in the script works fine. I just tested it. 

However, there are some limitations...

Just as Lech points out, variables are instantiated in a multi-user system: The document variables are copied so that each user has its own copy. So you cannot expect it to work in a managed space. But in a private space it works.

Secondly, the script execution starts by flushing the entire data model, so that a new one can be built. This means that a dynamic variable definition (starting with an equals sign) will NOT work: Calculations cannot be made. But a static definition will work.

HIC   

mauvasco62
Contributor III
Contributor III
Author

Hello everyone,

thanks your feedback.

By adding a second control variable, the upload script is now working.

I still don't know if my colleagues will be able to upload the data correctly when the app is published.

Have a nice day

Mauro