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

Variable format

Dear all,

I have below statement to have date prompt during reload:


LET varbasunix = input('Start Date', 'Please enter the start date!');
LET varbitunix = input('End Date', 'Please enter the end date!')


I need your help for 2 different issue:

  • I would like to have cover all dates from the db if the user pass the input fields blank.
  • I want to prevent the user to enter wrong format into input field. The format must be as DD.MM.YYYY. Any different format should return with an error message.

Thanks for your support.

Best Regards,

3 Replies
peter_turner
Partner - Specialist
Partner - Specialist

Hello Asim,

Sounds like you need to test if the user has input a date.
As a possible example:
IF varbasunix = '' then
set the value to a date in the past like 01.01.1900
end if

To get the correct date format you might be able to set a parameter in the input box statement, or have a test where it checks the format, and then repeats the input box statement if the input is wrong format.
You could also use one of the date() functions to convert the user input into the correct format as needed. These are in the manual as i'm not sure the exact syntax.

Peter.

Not applicable
Author

Hi Assim,

see the attached example (Calendar box => Properties ...).

I suggest to use calendar boxes and variables for Start and End date.

See the script for creating logical date ilands.

Good luck!

Rainer

Not applicable
Author

Hi Rainer,

Thanks for your answer. But it doesn't fix my problem exactly. In my file when I try to reload it, QV prompts for a "start date" and "end date". When user enters these values, they will be used in the SQL statement. So calendar boxes don't fix my problem. Are there any solution for the format of prompting vairables?

Best Regards,