Compute Values from Answers#

A computation derives values from responses, for example an annual cost from a monthly cost. Computed values can drive display logic, fill question text, and appear as output variables.

Create the Computation#

  1. Open the add-item palette after the source questions and choose Computation.

  2. Open its editor and name it on the Description tab.

  3. On the Outputs tab, add a field for each computed value: a Name, a Representation Type, and, for a coded value, a code list.

  4. On the Inputs tab, declare the values the calculation consumes.

The computation editor The computation editor

Define the Calculation#

  1. On the Expression tab, add a step for each output field.

  2. Choose the Function and provide a Value for each parameter; a parameter can reference an input. The function catalogue is listed in Display Logic and Expressions.

  3. Alternatively, describe the derivation in prose on the Description tab, or turn on Use native code and write platform source on the Code tab.

Bind the Inputs#

  1. Leave the editor and click the input indicator on the computation’s card.

  2. In the Inputs dialog, bind each input to the earlier answer or computed value that feeds it.

Verify#

  1. Switch to Split or Preview and answer the source questions.

  2. Open the Parameters popover in the preview header; it lists each computed value with its live result, and a value can be pinned there for testing.

See also

Insert Answers into Question Text inserts computed values into question text.