Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Re: Variables in script + user input box

I would now like to use the variable (vDate3) and load it during the load script in a table (whilst still being able to update via input box), creating a formula similar to this:

Number - $(vDate3) as Number2;

Although am having issues - have attached a doc for "clarity?"

Kind regards, Rich

let vDate1 = 0;
Set vDate2 = 5;
Set vDate3= '=vDate1 + vDate2';  // << updates when user makes selection in input box

TempData:
Load *,
Number - '=(vDate3)' as Number2  // <<- how to update to have live value taken from interface/input box as per above
resident Data;
drop table Data;

13 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try this:

let vDate1 = 0;

Set vDate2 = 5;

Let vDate3= rangesum($(vDate1),$(vDate2));  // << updates when user makes selection in input box

TempData:

Load *,

Number - $(vDate3) as Number2  // <<- how to update to have live value taken from interface/input box as per above

resident Data;

drop table Data;


talk is cheap, supply exceeds demand
trdandamudi
Master II
Master II

Replace the below line:

Number - '=(vDate3)' as Number2  // <<- how to update to have live value taken from interface/input box as per above

With the below :

Number - $(vDate3) as Number2

sunny_talwar

I have added a trigger instead of using the variable definition to set the value for vDate3. See if this helps.

Best,

Sunny

Not applicable
Author

Hi Sunny,

Thanks for review - unfortunately it the trigger doesn't appear to update following a new drop down selection..?

Gysbert / Thirumala

when scripted as follows, this hardcodes the result of vDate3 in the table (ignoring "future" input box selections)

Number - $(vDate3) as Number2

Any other suggestions?

sunny_talwar

A new drop down selection? in vDate1?

sunny_talwar

Seems to be working for me

Not applicable
Author

Hi Sunny,

Thanks for your patience - using your example, when reloading the doc - all is well...

When the value in the input box (vDate1) is adjusted, the "Number2" in table (in red) appears to remain as before / per the reload

Is this the case for you?

sunny_talwar

No, I see the number changing at my end.

I made some changes in the script als0:

//let vDate1 = 0;

//Set vDate2 = 5;

//Set vDate3= '=vDate1 + vDate2';  // << updates when user makes selection in input box

TempData:

Load *,

Number - $(vDate3) as Number2  // <<- how to update to have live value taken from interface/input box as per above

resident Data;

drop table Data;

//rename table TempData to Data;

Not applicable
Author

Hi Sunny,  I see "vDate3" updates on new selection - although "Number2" remains as is?

What can I change so I see what you see (ie ensured I saved doc to my pc etc..)?