Jump to content

Get filtered result from related table (portal)


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

Recommended Posts

I'm building a maintenance scheduling & tracking solution and am trying to create a field, which will calculate the date from the most recent entry into a related, LINE ITEMS table.  If I sort the related table by date descending, the following calculation works, as I've used it in other solutions:

GetNthRecord ( LINE_ITEMS::date ; 1 )

In this case, I'd like to filter the results by another field in the related LINE_ITEMS table.  For example, I'm going to have a text field, which contains a value from a list - MONTHLY, QUARTERLY, ANNUAL.  In the parent table, I'd like to have three calculation fields (one for each value), and obtain the (separate) most recent entry for MONTHLY, QUARTERLY, ANNUAL.

Do I need to have three, separate related tables, or can this be done via calculation "filter"?

Link to comment
Share on other sites

If this is for display only, you could use 3 one-row portals, each filtered to show a specific type. Otherwise it gets more complicated.

---
BTW, instead of sorting the relationship and getting the value from the 1st record, you could have used simply:

Max (  LINE_ITEMS::date )

or (assuming the records are entered in chronological order):

Last (  LINE_ITEMS::date )

Note also that:

GetNthRecord ( LINE_ITEMS::date ; 1 )

can be written simply as:

LINE_ITEMS::date

since a reference to a related field always gets data from the 1st related record.

Link to comment
Share on other sites

This topic is 765 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
×
×
  • Create New...

Important Information

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