Concepts
Virtual field

Virtual field

Virtual fields are a way of building fields in your data set from the fields which already exist.

You can use mathematical operators and conditions to define these fields.

type Condition = {
  // https://docs.vizzly.co/concepts/query
  // Currently only 1 "and" condition is allowed.
  if: [Array<Query.Filter>];
 
  // If the condition is met,
  // what should the definition look like?
  then: Definition;
 
  // If the condition is not met, what
  // should the definition look like?
  else: Definition;
};
 
// https://docs.vizzly.co/concepts/query
type Calculation = number | Query.Measure | Condition;
 
type Definition = [
  Definition | Calculation,
  "*" | "-" | "/" | "+",
  Definition | Calculation
];
 
type VirtualField = {
  // https://docs.vizzly.co/concepts/field
  field: Field;
 
  // Describes how the value of the field is calculated.
  definition: Definition;
};
Last updated on March 13, 2023