Jump to content

min and max functions


This topic is 5684 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Greetings,

This one should be simple, and yet...

What I would like to do is a button that resets the date fields I use to filter the data displayed in a portal to the minimum and maximum date values of the table, so that all entries are visible and so that I can know what the date range is.

I tried this: (btw the Filter fields are global of course)

Go to layout ["LayoutName"(TableName)]

Show all records

Set Field [OtherTableName::FilterFromDate; Min(TableName::Date)]

Set Field [OtherTableName::FilterToDate; Max(TableName::Date)]

Go to layout [Original Layout]

...but it sets the filter fields to the active record's date instead of the minimum of the whole table!

Am I wrong or is there a way to do it without scanning every record through a script?

Thanks

Link to comment
Share on other sites

You could do this without any extra fields by sorting the records by date, going to the first record, setting the minimum, and going to the last record to set the maximum.

Or, stay in the Parent layout and do only this:

Set Field [ Parent::FilterFromDate ; Date ( 1 ; 1 ; 1 ) ]

Set Field [ Parent::FilterToDate ; Date ( 12 ; 31 ; 4000 ) ]

Set Field [ Parent::FilterFromDate ; Min(Child::Date) ]

Set Field [ Parent::FilterToDate ; Max(Child::Date) ]

Link to comment
Share on other sites

This topic is 5684 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.