all

all, function

def nosort process all(value: boolean): boolean default true

Returns true when all values in value are true. For an empty group, it returns true.

Examples

table T = with
  [| as Id, as IsValid |]
  [| "a",   true       |]
  [| "b",   true       |]
  [| "c",   true       |]

allValid = all(T.IsValid)

show table "All valid" with allValid

Output:

allValid
true
table T = with
  [| as Category, as IsValid |]
  [| "A", true  |]
  [| "A", true  |]
  [| "B", false |]
  [| "C", true  |]

table Categories = with
  [| as Category |]
  [| "A" |]
  [| "B" |]
  [| "C" |]
  [| "D" |] // empty group

Categories.AllValid = all(T.IsValid) by T.Category at Categories.Category

show table "Validation" with
  Categories.Category
  Categories.AllValid

Output:

Category AllValid
A true
B false
C true
D true

Remarks

The all aggregator is marked nosort because ordering does not affect logical AND. The default value true for empty groups follows the usual convention for empty conjunctions.

See also

User Contributed Notes
0 notes + add a note