Formula Variable

What is a Formula variable? 

Put your algebra skills to the test!  A Formula variable is a custom variable type that allows you to carry out calculations on other variables.  With the Formula variable, you can

  • Use the variable in messaging to alert participants about increases or changes in goals 
  • Set targets and goals to calculated values 
  • Create ramp up periods - help participants transition from baseline averages to study goals 
  • Administer the goal selection survey - allow participants to choose their own goal based on baseline data collected during enrollment  

How do I set up a Formula variable?

    1. Navigate to Manage Study --> Variables 

    2. Click '+ New Variable'. 



    3. Give the variable a friendly name.  
      1. (lightbulb)Tip! Choose something that you will remember when you are building the variable into target modifications or participant messaging and incidents. 



    4. Select the arm.  If the formula variable is calculating based on other arm-specific variables, you must select that arm.  Otherwise the variable will not be available to use for the formula calculation.

    5. Next select the variable type.  For this example, we want to select Formula. 


    6. Once you select Formula, the formula field will display. You can create equations using any of the following supported characters.  (warning) The formula variable supports order of operations!
      1. Supported characters: 
        1. addition: +
        2. subtraction/negation: -
        3. division: /
        4. multiplication: *
        5. parentheses: ( )
        6. powers: ^ (e.g., 2^3)
    7. To create your formula, copy the variables exactly as listed and add any operators. 



    8. Adjust rounding criteria, if needed. 



    9. Click 'Save Variable' 

    10. Your new variable will be listed on the Variables overview page. 

How do I use a Formula variable? 

In Messaging:

  1. Navigate to Study Arms under Manage Study. Click 'Manage Event Schedule'. For arm specific Formula variables, remember to select the arm for which the new variable was created.



  2. Either create a new event or edit an existing event. You can inclue your new variable on event creation or in the logic screen. 

  3. Imagine the following scenario: I want to tell a participant what their new, 10% higher, target is for this week. 



  4. When the participant receives this message, the variables will be replaced with their current target value and target value in 7 days. 



  5. Click 'Save' Logic' 

  6. WARNING If you change the name of your available after it has been added to a message or incident text box, it will NOT update, and you will need to manually update it.  Therefore once you create your variables and add them into messaging, we recommend keeping the original name. 

Setting targets and goals to calculated values 

Want to not only notify participants about changes in goals but also implement the change? You can do this in event logic! 

  1. Navigate to Study Arms under Manage Study. Click 'Manage Event Schedule'. For arm specific Formula variables, remember to select the arm for which the new variable was created.



  2. Either create a new event or edit an existing event and then click into the event logic screen. 

  3. Imagine the same scenario as above: I have told the participant that their new goal is going to be 10% higher this week.  Now I have to set their new target to increase to be 10% higher. 

  4. In the 'Then' criteria, under 'Select Action' choose, 'modify the participant's target'. 

     

  5. Next select 'Set' and choose the target.  This will display all targets configured for this arm.  In this scenario, we want to select the Fitbit steps target. 



  6. Then select what to set the target to.  Here we want to set the target to a Variable. 



  7. Once you select 'Variable', all arm specific and study wide variables will display.  Choose {{ @target x 10% }}



  8. (warning) Note! You could also set up the modify target via a calculation.  However, the benefit of using the variable is that it can be included in messaging. 



  9. Click 'Save logic'. 


Creating ramp-up periods from baseline value to target value: 

See Target Value Variable for step by step instructions! 

Allowing participants to choose their own goal:

See Enrollment Run-In Variable for step by step instructions!