Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

Branching Logic Basics

Branching logic allows you to keep a field hidden until needed. For instance, if a question pertains to one type of participant, but not another, the field will remain hidden to the participants that don’t need to see it, and appear for those that do need to see it.

...

  • always based on previous logic

  • can only be coded within a project not between multiple project

  • available between instruments within a project

  • developed using a drag and drop method or advanced syntax method

Example of branching logic development

Develop a field that is only required for certain participants such as the following:

...

Click the branching logic icon on the field that is only required for certain participants. Here you can drag and drop (easiest method) or use advanced syntax and hand type your logic in the box above. as seen below:

Drag and drop format

Decide which instrument your logic is coming from for that field

...

  • If there is no branching logic for a field, that field will always present itself to every participant.

  • If you rename the variable for a field, remember to change the branching logic that contains that variable name. For instance if you change [gender] to [gender_one], you will need to go to the field that has branching logic [gender]='1' and change the branching logic to [gender_one]='1'.

  • Always test your project thoroughly to ensure your branching logic is working as expected.

REDCap Branching Logic Language using Advanced Syntax

And statements use the logic “and” between parameters. Use this logic if you need your branching logic to fire based on two parameters such as [age] > 18 and [sex] = '1' (Here we are saying “age greater than 18 and sex is equal to 1 which will either be Male or Female depending on your field choices).

...

(Here we are saying age not equal to 18). So this will fire if age is equal to anything except 18.

...

Branching Logic Math using Advanced Syntax

“+” add

“-” subtract

“/” divide

...

“<=” less than or equal to

Examples of all math logic

...

Branching Logic with Events

When you have events in your project, every variable name in your advanced syntax, need to be appended by the event name.

...

If you have arms in your project, event names will be different per arm, for example if we have the event Demographics in each arm and we have two arms, then the event name will be [demographics_arm_1] or [demographics_arm_2].

Remember

In order for your logic to work, you need to look for the “Valid” note at the bottom of your branching logic window.

...