Skip to content

RowId Type

The RowId type is used to declare variables that store a unique identifier for a specific row (also known as a record) of a database table.

RowId variables can be used to store record identifiers and to find records identified by a RowId value.

Example

Open Customer
RowId[] riCustomers  // array of RowId's

Loop through the customer table and store each row's ID:

Integer iSize
Boolean Found

// Loop through the customer table and store the RowId
For i From 0 to (SizeOfArray(riCustomers) - 1) Begin
    Get RowID(Customer.File_Number) to riCustomers[i]
End

Now loop through the RowId's and find the associated row:

For i From 0 to (SizeOfArray(riCustomers) - 1) Begin
    // Find the customer for this row
    If (FindByRowID(Customer.File_Number, riCustomers[i])) Begin
        Showln Customer.Name
    End
End

The above example loads each row of the customer table and stores the RowId in an array of type RowId. In the second loop, the array is iterated and each stored RowId is used to locate the corresponding row in the customer table.

RowId Composition

The data that forms the RowId of a particular table is specific to the design of that table. For example, in a simple case, it may be composed of an integer value, or it may be a composition of an integer, a string, and a date value. It could also be a number, a Boolean, and a date, etc.

In general, the format of the data that is stored in a RowId is internal and cannot be manipulated directly.

Manipulating RowIDs

All manipulation of RowIDs is performed using RowId functions. Using the RowId functions, you can:

Retrieve a RowId

Example:

Open Customer
RowId riCustomer
Boolean bFound

Get RowID(Customer.File_Number) to riCustomer

Find a Row

Example:

Move (FindByRowID(Customer.File_Number, riCustomer)) to bFound

The FindByRowID function loads the row into the customer table's buffer that corresponds with the RowId value stored in riCustomer.

Clear a RowId

Example:

Move (NullRowID()) to riCustomer

After calling the NullRowID function, riCustomer contains the null RowId.

Test for a Null RowId

Example:

If (Not(IsNullRowID(riCustomer))) Begin
    Move (FindByRowID(Customer.File_Number, riCustomer)) to bFound
End

Test for Equality

Example:

RowId riBestCustomer
//..
Get RowID(Customer.File_Number) to riCustomer

If (IsSameRowID(riCustomer, riBestCustomer)) Begin
    Stop_Box("Best customer is: " * Customer.Name) ""
End

Serialize a RowId

Example:

String sRowID
Move (SerializeRowID(riCustomer)) to sRowID

De-serialize a RowId

Example:

Move (DeSerializeRowID(sRowID)) to riCustomer

Web applications and web services use serializing and de-serializing to transform RowIDs into and out of a format that can be used in URLs, web pages, and web services.

Web Applications

The RowId data type is not supported in Web Properties, including structs and arrays. If you need to store RowIds, serialize them to a string using the SerializeRowID() function.

More Information

For more information regarding RowIDs, refer to the RowId command and the RowId Helper Functions.

For information regarding RowIDs and data dictionaries, refer to the DataDictionary class.