2 Replies Latest reply on Mar 8, 2017 12:26 AM by Johan Hedman

    How to get field value out of a portal.

    A2Quser

      OK, I have a properly linked portal, each row containing a test performed on one instrument.  I set up the portal to sort by inverse date, so the latest test is at the top.  How do I get (some of) the fields in the first row into other fields, so I can display the latest into for each instrument?

       

      I can use a summary function to get the maximum date - the latest one.  But other info, such as a test condition factor or test operator, are not always the highest or lowest.  They _are_ all in the first row, since I sorted it to have the latest at the top of the portal list.

       

      Years ago I used GetRepetition(field;1) to pull of that first row of info, but it is not working now.  I don't know why.

       

      The help files discuss  Go to Portal Row (first, last, or next) and Get(ActivePortalRowNumber).  How to select a field once one is 'in' a portal row is not clear to me yet, but I'm willing to try.

       

      So my question is:

       

      a)     Can I make GetRepetition(field;1) to pull info off the first row, & if so, how?

      OR

      b)     How to get those fields in the first row into fields outside the portal, so I can put them into a table outside the portal?

        • 1. Re: How to get field value out of a portal.
          user19752

          You can sort related records in relation graph, not only portal. If you sort in graph, you can get value from 1st related record according to the sort order as

          table::field

           

          Or, there is another function than GetRepetition,

          GetNthRecord ( table::field ; num )

          num can be count of related record, for "last" record on sort of relation graph.

           

          These 2 forms does nothing with portal if that is evaluated out of portal, get data from relation.

          • 2. Re: How to get field value out of a portal.
            Johan Hedman

            Get(Repetition) has nothing to do with Portals. Portals are related information from another table, where as Repetition are asking for information in your own table.

             

            Your portal is using a relationship. That relationship could have a sort order or not. If it does not have a sort order, the related records would be in creating order through your relationship. In your layout you can then setup if you want the portal records to be sorted or not.

             

            1. You have a sorted relationship. Then you will have all records be sorted on your date field

            2. You do NOT have sorted relationship but have it sorted in your portal setup. Then you can have information from first created record though your relationship.

             

            Then you can also use GthNthRecord like user19752 wrote about above.