MikeBrown
Novice

Using predefined date ranges in list views

I have a basic form which records events and any correspondance related to that event.

 

I would like to produce a "report" where the user can select from the predefined date ranges (this week, last week, this month , last month, etc...) and have the list return only the results from the specified range.

 

Can someone point me inthe right direction?

 

Mike

 

 

0 Kudos
Reply
3 Replies
Andrew_Blinco
Apprentice

Re: Using predefined date ranges in list views

Hi Mike

 

There are probably a number of ways to do this, but this is one way using only smartforms.

 

  1. Create an item view with a drop down box for the date ranges (this week, last week etc)
  2. Use static values in the drop down box, add your date ranges and use integers for the values (i.e.  values: {1,This Week}}, {2, Last Week} etc)
  3. Create expressions to calculate all the dates you require (based on todays date). For example create a expression "OneWeekAgo" using the AddDays function (i.e. Add Days (Today(),-7)
  4. Drop your item and report list view onto a form
  5. On the form add a rule for the drop down change event
  6. On this rule use conditions ("control on a view contains a specific value") to check the value of the drop down and then call the listview list method and add a filter use the expressions. For example if user selects "1" (Last Week) then call the list method with a filter [Date] > [OneWeekAgo]
  7. If if the filter requires 2 dates (e.g. Last Month) then add multiple rows to your filter

If you need to precise about the date range, for example you want Last Week to be Monday - Sunday of the previous week (not just the last seven days from Today) then you can use some of the other date functions, such as Start of Week, End of Month etc. You might need to get a bit creative with these to get the dates you need.

0 Kudos
Reply
MikeBrown
Novice

Re: Using predefined date ranges in list views

Thanks Andrew,

 

I will have a look at this.

 

If I drop the OOB report header onto a blank form then there is the ability to select predetermined date ranges, to be honest I was hoping these would be avialble easily so I don't have to recreate the wheel (as per the attached screen shot).

 

This appears to be reporting base don workflows, there are no workflows in my system, purely some forms which populate and report on a SQL table.

 

Mike


predefined_dates_2299.jpg
0 Kudos
Reply
Andrew_Blinco
Apprentice

Re: Using predefined date ranges in list views

Hi Mike

 

Yes the report header control is only for use with the other reporting controls, which are all workflow related.

0 Kudos
Reply