1 Reply Latest reply on Jan 31, 2013 1:43 PM by philmodjunk

    Filter portal based on date range

    EP

      Title

      Filter portal based on date range

      Post

           I would like to display 2 fields above a portal, where  user can enter a date in each to filter the portal records within thos dates.  I'm thinking I need to use 2 global fields for this, just not sure what the filter expression would look like.  Can anyone chime in?

           Also, I want to add an OnLayoutEnter script that uses Set Field to display the "Year to Date" upon entring the layout.  I would use get (currentDate) in the second field, but what would the calc be for the first date field?

           Thanks

        • 1. Re: Filter portal based on date range
          philmodjunk

               I don't know your table occurrence names so replace my names with yours:

               Globals::gStartdate < PortalTO::Date AND
               Globals::gEndDate > PortalTo::Date

               This type of range filtering can also be implemented at the relationship level instead of as a portal filter. There is also a way to use a return separated list of dates instead of inequalities--which may update your portal more quickly if implemented at the relationship level.

               To get the starting date for a year to date date range:

               Set Field [Globals::gStartDate ; Date ( 1 ; 1 ; Year ( get ( CurrentDate ) ) ]