user2548662
user2548662

Reputation: 51

How do I set up multiple if statements that open up multiple fields in REDCap?

I am new to REDCap and I have no idea how to set it up. I want to build something like this:

How many people go in? X -> opens up X fields

Did person 1 use A?

Did person 2 use A?

…all the way to X

I’ve only been able to create multiple fields

I’ve tried IF statements but I can’t seem to find the function to open new fields

Upvotes: 1

Views: 888

Answers (1)

cristian-vargas
cristian-vargas

Reputation: 737

Based on your description (and perhaps there's more information missing here), this might not be possible unless you know ahead of time what your maximum number of people who enter a room can be (let's say 100 for an example). And let's say you have a variable called room_population to represent the number of people in the room. If you know room_population can never exceed 100, you can create a series of variables called person1_A_use through person100_A_use to represent each person's use of A, a series of variables called person1_A_quantity through person100_A_use to represent how much of A each person uses, and a series of variables called person1_A_waste all the way up to person100_A_waste to represent how much of A each person wastes. Then modify each variable with branching logic so that it is only displayed if the value of room_population exceeds a certain threshold. For example, person2_A_use, person2_A_quantity, and person2_A_waste would only appear if room_population > 1.

You cannot design an instrument in REDCap where the number of potential variables is unknown and changes on the fly. If the people in the room were self-reporting this information through a survey link for instance, it would be a lot easier to do in REDCap. Your other option would be to create a repeating instrument that has the three variables to represent A use, quantity of use, and waste, and just create a new repeating instance for each person. At the end, the count of those repeating instances would give you how many people were in the room. But depending on what exactly your project entails, this may not be feasible since only one repeating instrument can be modified at a time (which can be a problem if you need to observe multiple people simultaneously, or if use of A needs to be tracked over a duration of time).

Upvotes: 1

Related Questions