3 Replies Latest reply on Mar 25, 2011 8:39 AM by philmodjunk

    Latest Modification Date

    alexandreriva

      Title

      Latest Modification Date & User Name

      Post

      Hello all,

      I would like to know how can I retrieve the latest modification date and user name across multiple related tables.

      I have one table called "Voucher", which stores automatically the latest modification date and user name. 
      This table is related to other tables, such as "Room Sales", "Payment Dates" and so on. These tables are also storing automatically the latest modification date and user name.

      So, I would like to know if a voucher has been modified in any of the related tables without having to actually open these tables. Can you help me?

      Thank you,

      Alex

        • 1. Re: Latest Modification Date & User Name
          philmodjunk

          Method 1: Use new table occurrences to create new relationships to each of these tables. Double click the relationship line and specify that the records in the relationship be sorted by the modification date in descending order.

          Say you have this relationship:

          Voucher::VoucherID = RoomSales::VoucherID

          create a new table occurrence of RoomSales by selecting it in the relationship graph and then clicking the button with two green plus signs so that you can set up this relationship:

          Voucher::VoucherID = RoomSalesLatestUpdate::VoucherID

          and set the relationship to be sorted as I described above. (Using a new relationship to a new table occurrence keeps the relationship options unchanged.)

          Now you can refer to RoomSalesLatestupdate::UserName and RoomSalesLatestUpdate::Modificationdate to access the most recently modified data for that set of related records.

          Method 2: create a layout (This layout will be hidden from the user) to Voucher and place portals on it to each of the related tables. Specify a sort order in each portal that sorts the related records by the modification date field in descending order. Use the Name box on the Inspector's Position tab to give each portal an object name. Scripts like this can then check the mod dates and other info in each portal:

          Freeze Window
          Go To Layout [//layout with portals we just set up]
          Go To Object ["RoomSalesPortal"]//use object name in quotes that you specified in the Inspector
          Set Variable [$lastUpdate ; Value:  RoomSales::ModificationDate ]
          // and so forth
          Go To Layout [original layout]

          If "Table Occurrence" is a new concept, you might want to read this:  Tutorial: What are Table Occurrences?

          • 2. Re: Latest Modification Date & User Name
            Kays

            heyy,

            if you just wanna display the field, u could simply add the field in "modify table view", it should be displayed since u made the proper links between the related tables.

            K|Z

            • 3. Re: Latest Modification Date & User Name
              philmodjunk

              Or just add the field to list or form view layouts. All of those are different variations of "Now you can refer to RoomSalesLatestupdate::UserName and RoomSalesLatestUpdate::Modificationdate to access the most recently modified data for that set of related records."