Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

option for user input when reloading script

Hi,

I have the following load script and im wondering if there is a way for the user to input a date in somekind of input box which can be used for the load script?

Below is my current script and i would like the input (date in bold) to be used when a reload is required.

-----------------

LOAD [Sort Date],
'12/07/2010' - [Sort Date] as [Days Outstanding],
DATTYP_ID,
TRX_DAT,
TRX_ID AS [Transaction ID]
FROM
data\TRANSACTION_DATES.qvd
(qvd);

-----------------

It would also be nice if a button was available that upon clicking will ask the user to input a date and then commence reloading the script.

Any help would be great.

Regards

Jason

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Jason,

You will need to assign the Input() value to ReportStartDate like this:

let ReportStartDate = Input('Enter Report Date (format DD/MM/YYYY', 'Input box');

And then convert the input text value to a date value in your expression like this:

LOAD Date#('$(ReportStartDate)') - [Sort Date] as [Days Outstanding], etc

-Rob

View solution in original post

6 Replies
Not applicable
Author

I got the the input box to work but i now get the following error:

Field not found - <ReportStartDate>

My script is below

------------

let rDate=Input('Enter Report Date (format DD/MM/YYYY', 'Input box');
LOAD [Sort Date],
ReportStartDate - [Sort Date] as [Days Outstanding],
DATTYP_ID,
TRX_DAT,
TRX_ID AS [Transaction ID]
FROM data\TRANSACTION_DATES.qvd(qvd)
Where ReportStartDate=$(rDate);

-----------------

Any help would be great.

Thanks

Jason

pablolabbe
Luminary Alumni
Luminary Alumni

Jason,

First create the variable ReportStartDate and initialize it in your script. Then you can use the variable in an input box.

Cheers,

Pablo

Not applicable
Author

hi thanks for your advise, im not sure how to create the variable.

what should my script look like if i wanted to do this?

kind regards

jason

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Jason,

You will need to assign the Input() value to ReportStartDate like this:

let ReportStartDate = Input('Enter Report Date (format DD/MM/YYYY', 'Input box');

And then convert the input text value to a date value in your expression like this:

LOAD Date#('$(ReportStartDate)') - [Sort Date] as [Days Outstanding], etc

-Rob

Not applicable
Author

Many thanks Rob this worked just fine.

Not applicable
Author

Does anyone know how to add a default value to an user input box.

I have the following input box:

let ReportStartDate = Input('Enter Report Date (format DD/MM/YYYY', 'Input box');

And i want by default this to display todays date. The user has the option to change the default 'todays date' or enter a date of their own.

Regards

Jason