Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set date in script using input box in sheet

Hi all,

Sorry if this is a daft question but I just can't seem to get it working.

In my script I want to connect to a database table and get all the data for a specific day. I want the user to be able to set the date in the interface. So I have an input box in which I have put a variable called StartDate, but how can I get this into the load script?

TIA,

Tony

1 Solution

Accepted Solutions
Not applicable
Author

Hi Tony,
try this script:

SELECT *
FROM _DBTABLE_
WHERE _date_=$(StartDate);

Alex

View solution in original post

6 Replies
Not applicable
Author

Hi,

in load script you can use input function.

For example:

let vDate=Input('Enter Date', 'Input box');

SELECT *
FROM myDB where date=$(vDate);

Not applicable
Author

Thanks Alex, that's cool, and I got it to work.

But I'd still like to take the date from an on-screen input box. Any ideas on that one?

Thanks,

Tony

Not applicable
Author

Hi Tony,
try this script:

SELECT *
FROM _DBTABLE_
WHERE _date_=$(StartDate);

Alex

Not applicable
Author

Fantastic! who'd have thought it was as easy as that??!? I've been trying all this GetContent and SetContent stuff all day.... Surprise

Thanks for your help,

Tony

Not applicable
Author

Hi,

I have a similar problem in which i require input from a user (to add a date) this date is then used for the script reload.

I got the the input box to work but i get 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

Not applicable
Author

Hi Jason,

Is ReportStartDate a field in your qvd file? Because the error message you are getting would suggest to me that it is not. If it is not a field then you might want to try using $(rDate) in its place directly. Or, alternately, set ReportStartDate = $(rDate) ealier in the script.

Either way, you may also need to look at inter record functions to see if you can do the calculation


ReportStartDate - [Sort Date]


as part of the script. I don't know much about inter record functions but search the help files and you might find something useful.

Hope that helps,

Tony