1 Reply Latest reply on Dec 14, 2010 9:42 AM by philmodjunk

    Pulling data from previously inputted data

    raykennedy

      Title

      Pulling data from previously inputted data

      Post

      I am trying to pass data along to another record.

      When I go to a layout I would like to pull the last inputted value. So I have two fields...

      1. Current Price

      2. New Price

      Upon entering price adjustments I am dynamically updating the New Price from another layout through scripting. In the same process I would like the Current Price in the new record to be pulled directly from the last entry field or previous record of New Price.

      In Summary

      New Record - Current Price = Old Record - New Price. (Does that make sense?)

      What I don't know how to do or even if it can be done this way, I would like to know if there is a way to write a script that would allow you to pull data from a previous inputted record. It would need to be able to identify that it was the last inputted record in relation to that Transaction. I do have date field in there so if that is helpful, could that be used to identify the most updated field. That would be the best if possible.

      Hope that is clear.

        • 1. Re: Pulling data from previously inputted data
          philmodjunk

          There are a number of different approaches that can be used which is best depends on the design of your database and layout.

          GetNthRecord is a function that can pull data from the previous record.

          GetNthRecord ( Table::NewPrice ; Get ( RecordNumber ) - 1 ) will pull data from the previous record listed in the found set or a portal. Whether that record always represents the record with the most recently inputted data depends on the design of your layout.

          A self join relationship that sorts by date so the most recently dated record is first, can also be used to access a previous record. How you structure that relationship depends again on the structure of your database. It could also sort by a serial number field to put the most recent record first.