Skip to content

Indicate Command

Obsolete

Indicators are obsolete, with the exception of predefined indicators that already exist in the language. Among the reasons for this are the limit of 89 user-defined indicators per program and that indicators are global.

Use the Boolean command to declare Boolean variables instead, or declare properties in classes and objects. You can use the move command to set and retrieve the value of indicators.

Example

Indicator Approved
Indicate Approved as (Company.Credit > 0)
[Approved] Begin
    // add code here
End

Can be changed to:

Boolean bApproved
If (Company.Credit > 0) Move True to bApproved
Else Move False to bApproved
If (bApproved) Begin
    // add code here
End

Purpose

To set an indicator true or false based on a logical test or the value(s) of other indicator(s).

Syntax

Literal:

indicate
indicator
true | false

Comparison:

indicate
indicator
as
variable
lt | le | eq | ge | gt | ne | in | match
variable

One other indicator:

indicate
indicator
as
[indicator]

Multiple other indicator(s):

indicate
indicator
group any | all [
    indicator [indicator] [indicator]
]
[
    and | or any | all [indicator
    [indicator][indicator]
]

Expression:

(expression)

Buffer status:

indicate
indicator
status
df_filename

When indicator is the first-named (set) indicator, it must not have brackets [] around it, and when it is (one of the) later-named (setting) indicator(s), it (they) must have brackets around it (them).

What It Does

Indicate sets the value (true or false) of the first-named indicator according to:

  • A literal true or false
  • The results of a comparison of the values of two variables
  • The value of one second-named indicator
  • The values of several later-named indicators
  • The status of a record buffer

The word not before the name of any indicator inverts the result of the command (from true to false and from false to true). When an indicator is used in brackets [], the not must also be within the brackets.

The value of an indicator may be set to a literal true or false unconditionally:

indicate purchase false

In this example, Indicator purchase is set false. The value of purchase remains false until another indicate command sets it true.

The value of an indicator may be set according to the results of a comparison of the values of two variables:

indicate in_stock as sale_quan lt on_hand

In this example, Indicator in_stock is set true if the value of variable sale_quan is less than (lt) the value of variable on_hand.

The value of an indicator may be set according to the value of another indicator:

indicate approved as [credit_checked]

In this example, Indicator approved is set true if Indicator credit_checked is true. If credit_checked is false, approved will be set false.

The value of an indicator may be set according to combinations of the value of one or two groups of indicators:

indicate good group;
    all     [kind        honest        faithful    ] and;
    any     [brave       wise          fair        ]

In this example, if Indicators kind, honest, and faithful are all true and at least one of the Indicators brave, wise, and fair is true, Indicator good will be set true. good will be set false if either kind, honest, or faithful is false, or if neither brave, wise, nor fair is true. The semicolon line breaks and spacing are only to accommodate physical line length and readability.

See the Group Command Component for explanations of the all and any indicator conjoiners, and the and and or group conjoiners.

The value of an indicator may be set according to whether a record in the record buffer for a database file is active:

indicate ready status vendor

In this example, Indicator ready is set true if the record buffer for the vendor file contains an active record.

This is useful when you are doing successive finds in several files and need program action that depends on whether the find for a particular file was successful.

Indicator can be driven by the Boolean value of a logical expression:

indicate warm as (temperature >= 35)

In this example, Indicator warm is set true if the value of Variable temperature is greater than or equal to 35. If the value of temperature is less than 35, Indicator warm is set false.

Indicator can be driven by the value of a mathematical variable or expression. The integer value zero (0) is Boolean false, while any other value, positive or negative, is true.

indicate leapyear as not (mod(year, 4))

In this example, if the modulo (remainder) of dividing the value of integer Variable year by 4 is 0 (false), Indicator leapyear is set true. If the value of year is not evenly divisible by 4, leapyear would be set false. By itself, this test would yield a wrong result for years evenly divisible by 100 (which are not leap years).

Using Indicators

Indicators are used to make execution of a command line conditional on the value of the indicator. Used this way, they are placed at the beginning of a command line, in brackets []:

[bird] showln "Good chance it can fly!"

In this example, the showln command is executed if Indicator bird is true. If bird is false, the command is skipped.

Indicators can be notted in the command line:

[not bird] showln "Can't fly without an airplane!"

In this way, up to three indicators may be combined to control a command line:

[active credit_ok not delinquent] begin
    accept amount to trans.amount
    save trans
end

In this example, the begin ... end block is executed if Indicators active and credit_ok are true and delinquent is false. If either active or credit_ok is false or delinquent is true, execution skips to the first command after the end command. As shown, not can be used among multiple indicators to invert the value of any of the indicators.

The following commands provide exactly the same action as the example above, without the begin ... end block:

[active credit_ok not delinquent] entry_item trans.amount
[active credit_ok not delinquent] save trans

Notes

  • You may reverse the sense of most forms of the indicate command by using the word not.

    indicate out as [not credit_check]
    

    This sets Indicator out true if Indicator credit_check is false.

  • You can even invert the value of an indicator unconditionally without having to determine its value:

    indicate invert as [not invert]
    

    or:

    indicate not invert as [invert]
    
  • You may also reverse the value of individual indicators within groups by using not.

    indicate bird group any [chicken flamingo not bat]
    

    Bird is true if Indicator chicken is true, or flamingo is true, or bat is false.

Once indicators are set, they may be used at the beginning of any command line to make that command line execute conditionally on the value of the indicator(s).

  • Rule of thumb: When there are three or fewer successive commands to be controlled by the same indicator(s), use the indicator(s) on each line. When there are more than three successive commands, use a begin ... end block with the indicator(s) only on the begin. When commands to be controlled are not successive, direct use of the indicator(s) is called for.

  • Indicators can be used to control indicate command lines the same as any other command line:

    [go_ahead] indicate done as balance eq 0
    

    In this example, Indicator done is set true if Variable balance equals 0, but only if Indicator go_ahead is true. If go_ahead is false, the command is not executed (done remains unchanged).

  • A variable or expression with a value of zero (0) or blank provides a setting value of false. A variable or expression with a value other than zero provides a setting value of true.