2 Replies Latest reply on Feb 24, 2014 6:04 AM by philmodjunk

    Finding field in last record of a set

    JamesAllen

      Title

      Finding field in last record of a set

      Post

           How do I find a field (Date) of the last record of a set of records?  For example, how would I get the last received date for an inventory item from a list of receiving transactions or the last date that an inventory items was picked to be displayed in my Inventory Master for that inventory item.

            

        • 1. Re: Finding field in last record of a set
          PaulHoward

               Are you asking how to find the *most recent* date in a found set? (Sorry, it's not 100% clear from the way you worded your question.)

               If so, I believe the simplest option is to create a new Summary field in the table in question. Call it something like "maxReceivedDate" or "mostRecentPickDate," and in the "Options..." dialog box select the "Maximum" radio button, then select the date field you're interested in from the list.

               Alternatively, if you're interested in finding the most recent date in a set of related records and you don't want to resort to a Summary field (for instance, if doing so would present performance issues), you could use the Max() function. For example:   

          Set Variable [ $mostRecentDate ; Value:Max ( myRelatedTable::dateField ) ]
          • 2. Re: Finding field in last record of a set
            philmodjunk

                 Is your set of records a found set or a set of related records?

                 Go to record/request/page [last] is a script step that will access data in the last record of a found set.

                 You can sort your records by date in descending order to make that record the first record

                 You can use GotoNthRecord ( field ; Get ( FoundCount ) ) in a calculation to access data in the last record of either a found set or a set of related records.