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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
amars
Specialist
Specialist

Inputbox to accept date

Hi all,

I have a qlikview file with section access. After opening it I reload the file with only record's with the filter for the user . Now I want to apply a filter for date, It should be like after section access & before reload. It should ask me Input for Start Date & End Date and should load data only for that duration. I can use Input box in Macro but the user may enter wrong value & that can cause trouble. How can I accept input without any problem's. Any ideas on that.

Thanks in advance for your valuable input's

Regards

Amar[:'(]

13 Replies
Anonymous
Not applicable

Amar,
There is no GoTo (I wish it were). What I suggested in my earlier post was not a ready solution but a logical algorythm. But QV does have some scrpt control abilities, for example "Do ... loop", which can be used like here:


LET DateCheck = null();
Do until DateCheck='OK'
EnterStartDate:
Load
Input('Enter Start Date as MM/DD/YY', 'Start Date') as Start
autogenerate 1;
LET vStartDate = peek('Start');
//
if len(trim(date(date#(vStartDate, 'MM/DD/YY'))))>0 then
LET DateCheck = 'OK';
else
LET DateCheck = 'Not a Date';
end if
//
loop
DROP TABLE EnterStartDate;
LET DateCheck = null();

Try to run this script and enter different types of data - text, numbers, whatever. It will allow to continue only if you enter a date.
(Notice that there is no need to use macro.)

Anonymous
Not applicable

The attached example checks the Start and End dates to be valid dates, and if the End date is later than Satrt date.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I like your solution Michael. Just for completeness, I extended my alternative InputBox example to handle two dates and test Start < End. The constraint could be extended to test for min/max values as well. Reload will use the dates to generate a range of dates.

I also modifed my test to use the more robust len() check instead of IsNull(). Thanks for reminding me of that!

Your solution is probably more fitting for the original question. but my example might be useful for some of the other questions I've seen about user entered date ranges.

Example attached.

-Rob

amars
Specialist
Specialist
Author

Thank's bot of you Michael, Rob. The example's were of great help.

Regards,

Amar