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

pass dynamic v

I am loading data based on following query

SQL SELECT * FROM NWind.dbo.Orders Where OrderDate>='1998-02-26';

Is it possible to pass date entered by user as input field.

3 Replies
settu_periasamy
Master III
Master III

i think yes. You can create the variable and get the data from user using the Input statement option..

Try this..

SET DateFormat='M/D/YYYY';

T1:   //Sample Table
LOAD Date(Today()+IterNo()-1) as OrderDate,
     
ceil(Rand()*1000) as sales AutoGenerate 1 While IterNo()+1<=50;

LET vDate= Input('Please Enter the OrderDate (M/D/YYYY)', 'OrderDate Input');

NoConcatenate
T2:
LOAD * Resident T1 Where OrderDate>='$(vDate)';

DROP Table T1;

sunny_talwar

Depending on how you are taking user input (number, date in YYYY-MM-DD, or any other format), your variable might differ. But assuming that the user is going to input as 1998-02-26, you can try the below:

LET vVarDate = Date(Date#(vVar, 'YYYY-MM-DD'), 'YYYY-MM-DD');

SQL SELECT *

FROM NWind.dbo.Orders

Where OrderDate>='$(vVarDate)';

Here user will enter 1998-02-26 in an input box on the front end to the variable vVar

Kushal_Chawda

try this

Let vDate = date(makedate(2010,01,01),'YYYY-MM-DD') // Date= 1 Jan 2010. you can change the date you want

SQL SELECT *

FROM NWind.dbo.Orders

Where OrderDate between '$(vDate)' and '$(vDate)';