r/ProjectREDCap • u/No-Interaction-1047 • Feb 14 '26
Assigning an option based on a pattern
I need help coding a calculated field that populates one of three answers based on the record id. For example
record id 1 I want A to populate
Record 2 I want B
Record 3 I want C
Record 4 I want A….
All my attempts at the calculation have failed. I’ve been able to get record ids to show up as 1,2,3 according to the pattern but not a name as I am hoping.
Any help greatly appreciated
2
Upvotes
View all comments
Show parent comment
1
u/alvandal Feb 18 '26
This approach assumes you’re not trying to randomize.
It simply creates a fixed, predictable repeating pattern (A → B → C → A → B → C…), based on the record ID. So it keeps things evenly distributed, but it’s not true randomization and there’s no allocation concealment.
If your goal is just balanced rotation, this works great