numeric-compare
  • 27 Jul 2022
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

numeric-compare

  • Dark
    Light
  • PDF

Article summary

The numeric-compare parser will evaluate or load data from two columns and compare their values. Depending on the value of the operator attribute, the comparison will evaluate to true, false, or null.

It inherits attributes and behaviors from its parent: abstract parser - boolean.

Note - the columns attribute supersedes the column attribute, which is not used in this parser type.

Attribute - operator

The operator attribute is required.

{
  "parser_type": "numeric-compare", 
  "columns": [
    {...}, // parser one
    {...}  // parser two 
  ],
  
  // The operator attribute defines a comparison function.
  // Options include: 
  // "=" - equals
  // "!=" - not equals
  // "<" - parser one value is less than parser two value
  // "<=" - parser one value is less than or parser to column two value
  // ">" - parser one value is greater than parser two value
  // ">=" - parser one value is greater than or equal to parser two value
  //
  "operator": ">"
}

Attribute - columns

The columns attribute is required.

{
  "parser_type": "numeric-compare", 
  "operator": ">",
  
  // The columns attribute specifies two inner parsers to produce
  // values for comparison
  //
  "columns": [
    "ccc1", // column one name - a parser will be auto-generated
    "ccc2"  // column two name - a parser will be auto-generated
  ]
}

Attribute - columns as parsers

The columns attribute is required.

{
  "parser_type": "numeric-compare", 
  "operator": ">",
  
  // The columns attribute specifies two inner parsers to produce
  // values for comparison
  //
  "columns": [
    {...}, // parser one
    {...} // parser two
  ]
}

Was this article helpful?