Discussion board where members can get started with QlikView.
I there a way to select dates using a button? I need to add a button that dynamically selects the last 7 days based on the current date.
I tried the following, without any luck:
Does the format of ItemCreatedDate can influence the result? In this case, the format is "YYYY-MM-DD hh:mm:ss".
Can somebody help me on that one?
Go to Solution.
When changing the date field name, the search string has to be changed accordingly:
So instead of
you should use a search string like
hope this helps
Yes it may not work because of the format..
today() is a date and Date(today()) is a date also
your field ItemCreatedDate is a TIMESTAMP, you should interpret this field and format it as a date before, you can create a derived field in the script like this:
Date(Date#(ItemCreatedDate , 'the format you have on the DateFormat variable ')) as new_field_name
! on the button, when you identiy the Date field, make you to not put = sign !
Perhaps this? Or please post application to test, If dates are real date format then this should work
='>=' & Date(Max(ItemCreatedDate-7), 'YYYY-MM-DD') & '<=' & Date(Today(), 'YYYY-MM-DD')
You need to use interpreter to change the format of your Item CreatedDate
May be this..
Yes I beleive the format influence the result.. As a test you can try the very same search string in the search box for a List Box object containing the field you wish to search.
Actually you can (and perhaps should?) remove the time part from your ItemCreatedDate if only the date part is relevant.
Else try the following script in an empty app to examine some options for creating a timestamp for your button:
date(Today()-7) as Today,
timestamp(Now()-7) as Now,
timestamp(Date(Today()-7) & ' 00:00:00') as Timestamp,
Date(Today()-7) & ' 00:00:00' as Text
one solution could be to use the expression search syntax, thus avoiding date format issues:
='=Date>Today()-7 and Date<=Today()'
The Search String
The Expression Search
the example you have provided is exactly what I need to to! But for some reason, it does not work with my actual data.
Can you please post a sample of your data to test with?
There you go!
Thanks again for your help.