1 Reply Latest reply on Jul 28, 2011 9:37 AM by philmodjunk

    Compare previous record to the new record

    AllanMagsino

      Title

      Compare previous record to the new record

      Post

      I am trying to compare previous record from the current record. Example:

      If the customer ordered last 2011 and he would like to order again for 2012... The Renewal field should automatically put a "YES" since the customer is a renewal one.

      Else if there is no order from the previous year then the Renewal status should be NO.

       How can i do this?

      Thanks

        • 1. Re: Compare previous record to the new record
          philmodjunk

          If the "previous record" is literally the record just before it in the found set, you can use GetNthRecord to refer to values in the "previous" record.

          Otherwise, you can likely define a relationship that links your new record by customerID to all records in this same table with the same ID (This is called a self join). With the appropriate sort order, you can then refer to values in the related record and be referring to the most recent preceding order for this same client. (This is safer than getNthRecord as it will work the same no matter what other records are in your found set.)