To create a new variable, click + Create variable. New variables can be persisted in the output table, and also used in additional queries. You can perform operations against existing variables using a wide array of functions. Documentation on the various functions can be found in our variable methods page.
For example, if we wanted to look at the ratio between total payments and billed charges for a given record, we could divide
A common method to create variables is a
Case statement (or an 'if/else' statement), which allows you to specify one or more conditions to specify the values of the new variable.
For example, to create a boolean variable
isInArizona, we would create a comparison which finds each row where the value for
AZ and sets the value of our new boolean variable to
Case method takes advantage of comparisons, which are used throughout Redivis transforms.
Another common method to create variables is
Cast, which allows you to convert variables of a given type to another type. This method is useful for creating variables of uniform type to work with in other methods, coercing numeric values from string typed variables, and many other applications.
For example, we can round our float-type
average_reimbursement variable by casting it to an integer.
If the values in the input variable(s) can't be cast to the specified type, the transform will fail, unless you specify convert to null, which will set any un-cast-able values to null.