Calculated

A review of the Calculated Field in Device Magic.

Brett Long avatar
Written by Brett Long
Updated over a week ago

Note: For more info on Calculated Questions Functions and writing expressions, please see this article: Calculated Question Expressions


Calculated Question

On Builder:

App UI:

The Calculated Field is for calculating values, based on values provided or the outcome of other questions within your form.


Field Properties:

Label:

Name the field.

Set Expression:

Here you can set the expression that will determine what is calculated. A few sample expressions you can use:

Addition: SUM(sample_integer_1 , sample_integer_2 , sample_integer_3)
Subtraction: sample_integer_1 - sample_integer_2
Multiplication: sample_integer_1 * sample_integer_2
Division: sample_integer_1 / sample_integer_2 

Calculating hours worked: (Time_Out - Time_In) / 3600 

Please note, you can take this a step further and round your answer
Ex. ROUND((Time_Out - Time_In) / 3600, 2)
In this example, your answer would be rounded to the nearest hundredth.

Check out this article for more info on how to build advanced expressions.


Advanced Settings:

Hint:

This allows you to give a hint to help people answer a specific question. This will be displayed below the field, on the device.

Initial Answer:

A default answer provided by you, placed in the question field. This text can be removed by the user.

Identifier:

How the field is identified in the form (the name of the field). You can also provide custom identifiers for long questions, to simplify template creation. Even though longer identifiers take up more space on the template, the data pertaining to that placeholder may not use all the given space and could possibly throw your template out of bounds.

Active:

  • Always (always shows in the form and returns answers in submissions)

  • Only When (only shows in the form and returns answers in submissions under certain conditions – decided upon by you when you click the “Set Rule” button that appears)

Read-Only:

  • Never (not a read-only question)

  • Always (always a read-only question)

  • Only When (only a read-only question under certain conditions – decided upon by you when you click the “Set Rule” button that appears)

Validate Value:

Allows you to set a rule so as to ensure the question is answered according to a particular condition.

You are also able to set an error message so as to indicate to the person how they went wrong with their answer and what they need to do in order to correct it.

Timestamp answer:

Records down the time the question was answered.

Geostamp answer:

Records down the location where the question was answered.

Hidden:

Hide from User - Hidden questions are not visible to the user, but they are still active based on the active rule.

They may be used in calculations and the answers will be included in the submission.

Did this answer your question?