Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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[:'(]
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();
The attached example checks the Start and End dates to be valid dates, and if the End date is later than Satrt date.
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
Thank's bot of you Michael, Rob. The example's were of great help.
Regards,
Amar