

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using a button to create a selection
Hi everyone,
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:
- Created a button with "Select in field" as Action
- Identified the date field (in this case ItemCreatedDate)
- Used the following search string: ='>=' & Date(Today()-7) & '<=' & Date(Today())
- Just tried it... I'm not sure about that one!
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?
Nic
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
regards
Marco

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Nicolas,
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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to use interpreter to change the format of your Item CreatedDate
May be this..
Date((ItemCreatedDate-7),'YYYY-MM-DD')


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
Load
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
AutoGenerate 1


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
one solution could be to use the expression search syntax, thus avoiding date format issues:
='=Date>Today()-7 and Date<=Today()'
see also:
hope this helps
regards
Marco


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI Marco,
the example you have provided is exactly what I need to to! But for some reason, it does not work with my actual data.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please post a sample of your data to test with?
thanks
regards
Marco


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There you go!
Thanks again for your help.
Nicolas


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
regards
Marco

- « Previous Replies
-
- 1
- 2
- Next Replies »