Constants
The constants tab is where you can map numbers to options of a radio question. This is useful when you want to make a calculation based off a user's choice.
Last updated
The constants tab is where you can map numbers to options of a radio question. This is useful when you want to make a calculation based off a user's choice.
Last updated
Constants are numeric values that can be referred to with its reference.
Constant tables can be used to map multiple constants to options of a radio question. This is done by mapping each option to the reference of the constant.
Constants are not needed to make a checker. You can make a checker without using the Constants Tab.
To ensure that your constant table maps properly, ensure that all radio options are exactly the same as the constant table references.
If a customer went to a fruits stall and asked the stall assistant "How much does this banana cost?", the stall assistant would check the prices on a piece of paper that says:
Today's fruit prices Apple $1 Banana $1.50 Orange $1.20
The stall assistant looks up the price of Banana
and finds 1.50 dollars
. They can then tell the customer that bananas are $1.50 each, and can help ring up their total bill depending on how many bananas the customer took.
Here, the stall assistant is our checker, and the piece of paper –Today's fruit prices – is a Constant table
. See the use case example below.
Context: Our grocery clerk wants to calculate the total cost of a customer's groceries from a fruit stall. They need to find out which fruit the customer has taken, and multiply the price of that fruit by the number of pieces they took.
[Price of fruit] x [Number of pieces] = Total cost
Note: Options and references must have the same capitalisation. If a radio option is Apple, but the constant reference is apple, they are unable to be mapped.
This can be typed as O1*N2
.
Let's Save draft
and check it in preview.
Block type
Reference
Letter T references constant tables
Step 1: In the Questions Tab
, create aradio question to ask the customer which fruit they've taken, and anumeric question to find out how many pieces of fruit they've taken.
Step 2: In the Constants Tab
, create aconstant table to set the price of each fruit.
Step 3: In the Logic Tab
, create amap constant logic block to map ["Which fruit would you like to buy?" question ] to ["Prices of fruit" constant table ].
Learn how to use themap constant logic block.
Step 4: Still in the Logic Tab
, we need to multiply the price of the user's fruit choice with the number of pieces they took.
Because we mapped ["Which fruit would you like to buy?" question ] to ["Prices of fruit" constant table ], we need to use the outcome of that result (which is the price of the fruit chosen by the customer). Hence, our formula should be:
[Price of fruit chosen] x [Number of pieces taken] = Total cost
Constant tables are tied to a symbolic letter for its reference, as well as a number. Constant tables can only be used in the logic tab with amap constant logic block.
Constant table