Creating APIs‎ > ‎Logic‎ > ‎Rule Types‎ > ‎

Minimum or Maximum Rule Type

The minimum (min)/maximum (max) rule declares a parent attribute to be maintained as the min/max of a designated child role's maxed attribute, with an optional qualification to filter child objects.

The value of the attribute is updated to reflect the min/max of the specified attribute in the child objects whenever necessary. This includes child objects being added to and removed from the parent object, as well as modifications to the children objects that change their qualification in the min or the min value. Observe that min/max processing is triggered by changes to the child, as visible in the log.

For more information about the log, see Debug your API Project.

  1. In API Creator, go to Manage, Rules, and click Create New Rule.
  2. Select the Minimum or Maximum rule type, the table to which it applies, and click Create Rule.
  3. Define the parameters of the rule:

    Minimum/Maximum name

    The name of the min/max rule. 

    Tip: Leave this field blank for the system default.

    Table/column

    The name of the parent table and column representing the min/max result.

    Topics

    The topic associated with this rule.

    Children

    Defines the child role (first combo box) and attribute (second combo box) being minimized/maximized.

    For more information about roles and foreign key-based relationships, see Data Sources.

    Qualification

    Boolean JavaScript expression designating the child rows checked for the min/max.

    Optional: Yes

    Active

    Select to activate the rule (The definition must be complete).

    SQLable

    Indicates whether you can optimize the rule by executing it in SQL instead of in JavaScript.

    Just In Time

    You can indicate formulas and aggregates as Just in Time (JIT) rules. You can define JIT rules on persistent attributes and on rules of type formula, sum, count, min and max.

    If the value in the database is null, Live API Creator executes the rule on the first read, stores the value for that column in the database, and returns the value. To prevent Live API Creator from executing rules with null return values on every read, the rule should never return a null value.

    1. Click Activate and Close to return to the list of rules.

    The min/max rule is created.