2 Replies Latest reply on Nov 15, 2012 9:52 AM by TurtleKoala

    Displaying most recent related record

    TurtleKoala

      Title

      Displaying most recent related record

      Post

           Hello,

           I have two tables, one called Employee and another called Project. Each employee may have multiple projects. Every project has a date. I have a layout based on the Employee table, and I want to display information about the most recent project. I have an idea of how I might do this, but I feel like there is probably a better way. Right now, I am creating a portal which is sorted by date, and I am only showing one record. This works, but if i decide to pull in more fields from the related project, and if I want to show them on different areas of my layout, then I will have to create a new portal for each field, which seems messy.

           My other thought was to create a new occurrence of Project, and define a new relationship between Employee and the new Table Occurrence, but I am not sure how I would define that relationship.

           Does anybody have advice about the best way to do this?

           Thanks,

           TK

        • 1. Re: Displaying most recent related record
          philmodjunk

               Option 1:

               Open Manage | Database | Relationships and specify a sort order in the relationship that will sort your records so that the "most recent" record is the first related record. Then remove the portal, but keep the fields you currently have in the portal. When you have multiple related records and you add a field from the related table, the "first" related record supplies the data you see in the fields.

               Option 2:

               You are not limited to a "table like" view inside your portal. You can resize the portal row such that your single row is now a miniature "form" with fields and layout text arranged within it to suit your preferences.

          • 2. Re: Displaying most recent related record
            TurtleKoala

                 Thanks PhilModJunk.

                 I didn't realize that there was an option to sort when creating a relationship. That is exactly what I was looking for.

                 Thanks,

                 TK