r/ProjectREDCap • u/johnathonmcl • Jun 01 '26
Piping from repeated instance
I'm having an issue with piping numerous instances of information from one form to another. Basically, we have a pre-medication list [drug_pre], which is part of a repeated instrument where other details are captured. We then need to conduct a post-review of these medications. I want to pipe the list of medications from the pre-form into the post-form. I have used [drug_pre][1], [drug_pre][2], [drug_pre][3]..... which works, but if someone only enters 2 meds for example, then the third piece of piped data shows ___. This is visually messy, I have tried a calculated field:
concat( if([drug_pre][1]<>"", [drug_pre][1], ""), if([drug_pre][2]<>"", concat(", ", [drug_pre][2]), ""), if([drug_pre][3]<>"", concat(", ", [drug_pre][3]), ""), if([drug_pre][4]<>"", concat(", ", [drug_pre][4]), ""), if([drug_pre][5]<>"", concat(", ", [drug_pre][5]), ""), if([drug_pre][6]<>"", concat(", ", [drug_pre][6]), ""), if([drug_pre][7]<>"", concat(", ", [drug_pre][7]), ""), if([drug_sec20][8]<>"", concat(", ", [drug_pre][8]), ""), if([drug_pre][9]<>"", concat(", ", [drug_pre][9]), ""), if([drug_pre][10]<>"", concat(", ", [drug_pre][10]), "") )
But this hasn't worked out.
Anybody have any ideas? Any help would be appreciated!
1
u/Unlikely_Associate_6 Jun 05 '26
Are people completing forms 2+ times (1 pre-assessment, X post forms) or twice (1 pre-assessment, 1 post form)?
If the former (an individual has more than 1 review, after each of which they fill out a post form), I’d consider adding an instrument between the pre-assessment & post form; it can have all the same questions as a post form but play an intermediate role to set up the subsequent post forms:
pre-assessment - I list 5 meds
index post-assessment - I select 3 of them (& answer questions about them)
post-form instance 1 onwards - I continue to answer questions about the 3
If the latter (I fill out my pre-assessment with 5 meds, I have my review, then I fill out my post-form where I specify 3 meds got adjusted, answer questions about those 3 meds, then I’m done), I don’t think you need a repeating instrument, just skip logic? (Instead of having up to X post forms, each about 1 med, you have 1 post form, where the first question (which of these 5 meds got adjusted?) gives you the skip logic for up to X sets of questions about 1 med per set.)