Equinox Online Help - Language Reference - A to Z

Home

SameRecord

Applies to
SyntaxSameRecord
Action[Statement] Locates the current record inside a subtable block, outside the block.
ScopeOnly usable in subtables.
Notes

When you use a subtable block, Equinox temporarily changes the home table. You can select a new current record for this table, but if the subtable is unlinked then Equinox still remembers the current record in the old table. When you exit the block, the old current record becomes current again.

Some statements and functions can only be used inside a subtable block, so even if you don't want to change the home table, you must still use the block. If you locate a new current record within the block you effectively have two different current records for the same table: one within the block and one outside. In this case, you can use the SameRecord statement to make the current record inside the block the same as the current record outside.

You can also use this statement when the home table for the subtable block is a child or the parent of the home table outside the block. In this case, the appropriate child/ parent record is selected inside the block. Note that you cannot use this statement if the tables are relationally-linked, since there may not be a one-to-one relationship.

Note that if the home table for the subtable block is not the same as the home table outside the block, or they are not hierarchically-linked, then the statement will have no effect.

If the outer table is the parent and the inner a child, selecting a child index has the same effect as this statement.

If an error occurs, an error number is stored in the system workarea SysError.

CategoryRecord location
See Also CountRecords, CurrentTableName, FindRecord, FindRecordLock, GroupFindRecord, IsLookup, IsRecord, IsSameRecord, Lookup, LookupWrite
Example

This example method checks to see if the current customer has previously had an account. If so, the customers previous credit rating is brought forward. Closed account numbers are preceded with an "X".

The method attempts to locate an old account. If found, the old rating is copied to a variable. The SameRecord statement is used to locate the original record.

string test, OldRating

...

test = "X" & custcode

subtable customer, unlinked
FindRecord EQ, test

if syserror then exit subtable
OldRating = CustRating
SameRecord
CustRating = OldRating
end subtable | customer