API Reference

Assertion functions

  • not_null(any) - stops script execution gracefully when parameter is () (unity aka null)

Math functions

  • min(i64, i64) -> i64
  • min(f64, f64) -> f64
  • max(i64, i64) -> i64
  • max(f64, f64) -> f64
  • round(f64 | i64) -> f64
  • See rhai standard number functions for built-in functions.

String functions

  • join(array, delimiter: str, strict: bool) -> str
    • Will join an array of strings into a string interleaved by delimiter
    • Default for delimiter is a single space ( )
    • Strict mode will not convert any non-string array elements into strings and will raise an error instead. This is false by default.
  • See rhai standard string functions for built-in functions.

Type casting

  • to_int(f64 | i64) -> i64
  • to_float(f64 | i64) -> f64
  • to_int(str) -> i64
    • if the value cannot be parsed the function will return 0
    • use parse_int for finer control over this
  • to_float(str) -> f64
    • if the value cannot be parsed the function will return a NaN constant
    • use parse_float for finer control over this

Data processing

  • values(data: Map[], key: str) -> any[] - returns values at key from every object in data
  • distinct(str[]) -> str[] - returns all distinct strings in the input list
  • coalesce(any[]) -> any - returns the first non-unity value in input

Lookup tables

  • group_by(data_source_name: str, index_name: str, query: str) -> Map[]
    • lookup rows from group index
  • unique(data_source_name: str, index_name: str, query: str) -> Option<Map>
    • lookup specific row from unique index
  • group_filter(data_source_name: str, groups: ["<group index name>", ...], values: [<value1>, ...]) -> Map[]
    • Drill-down filter for filtering results by several groups in left-to-right order.
    • Each (group, value) pair will be run on only the results that matched value in the previous pair.
  • group_filter_inverse(data_source_name: str, groups: ["<group index name>", ...], values: [<value1>, ...]) -> Map[]
    • Inverted drill-down filter for filtering results by several groups in left-to-right order.
    • Each (group, value) pair will be run on only the results that did not match value in the previous pair.