CONSISTENT Function (Record)

Marks a C/SIDE table as being consistent or inconsistent.




Type: Record

The table that you want to mark.


Type: Boolean

The mark to be set on the table.

If this parameter is true, the table is marked as consistent. If this parameter is false, the table is marked as inconsistent.

Usually this function is only used for accounting routines. If your accounts do not balance, the accounts are inconsistent. This function ensures that inconsistent changes are not made in your accounts.

If an attempt is made to commit a write transaction when a table is marked as inconsistent, a message is displayed and all updates made in the write transaction are aborted.

A typical example of an inconsistency occurs when the sum of all the entries in a table containing general ledger entries does not balance (is not equal to zero).

In this example, your application includes a function object called ChangeAmount. This function is used to withdraw amounts that were put into the General Ledger Entry table in your application. When an amount is withdrawn from an account, the system is inconsistent until a corresponding amount is put in. The following code example illustrates the ChangeAmount function. The ChangeAmount function has one parameter, Amount, which is a Decimal data type.

GLEntry."G/L Account No." := '1000';
GLEntry.Amount := Amount;
Balance := Balance + Amount;
IF Balance = 0 THEN
  Consistent := TRUE
  Consistent := FALSE;

The function uses the variable Balance to express the change in balance. For example, when the function is used to withdraw $100, the Balance variable will reflect this as -$100.

When you use the function to put in one or more amounts whose total equals +$100, the Balance variable then equals zero and the table is marked as consistent. This means that if an attempt is made to put in an amount and end the write transaction (commit the change) without withdrawing a corresponding amount, an error occurs and the write transaction is canceled.

Community Additions