Rule Types

Rule Types
lac31
The following table lists the rule/logic types:
Rule Type
Description
Example
Derive an attribute value using other attributes in that table, or parent table (changes are propagated). For conditional assignment, use JavaScript if/else, or the ternary operator ((boolean)
?[true value]:[ else value]
).
Derive
Lineitem.amount
as:
return row.part_price * row.quantity_ordered
Derive
product_billofmaterials.value
as:
return row.kit_number_required * row.product.price
Derive
order.DueDate
as:
if (row.due_date === null) {     return new Date(moment(row.placed_date).add('months', 1) else     return row.due_date; // no change
Derive attribute value from parent attribute value (unlike formula references, parent changes are not propagated)
Derive
Lineitem.Price
as:
ParentCopy(product.price)
Derive attribute value by summing designated child attribute, with optional Child Qualification Condition.
Qualification is in in SQL Where syntax.
Derive
Customer.balance
as:
Sum(ordersList.amount_un_paid where is_ready = true)Sum(children where anAttribute != null)
Derive attribute value by counting designated child rows using a defined relationship, with optional Child Qualification Condition.
Qualification is in in SQL Where syntax.
Derive
Customer.big_order_count
as:
Count(ordersList where amount_total > 100)
Derive value as the min/max of designated child rows, with optional Child Qualification Condition.
Derive
Customer.maxOrder
as:
max(ordersList where is_ready = true)
Multi-attribute expression of class/parent attributes that must be met for a transaction to succeed - return true (else exception message is thrown); can execute as transaction rows are processed, or at commit time after all rows are processed.
Validate
Customer.CheckCredit
as:
row.balance < row.credit_limit
Multi-attribute expression of class/parent attributes that must be met for a transaction to succeed (else exception message is thrown); executes at commit time so your validation code sees the results of all rule executions for all rows (for example, sums and counts).
Validate
Purchaseorder.NotEmpty
on commit as:
return row.item_count > 0
Automatically insert a parent object if it does not already exist.
Create parent for GroupBy, for example,
empsales
to track total sales for employee each month.