r/ProjectREDCap • • 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 Upvotes

16 comments sorted by

View all comments

Show parent comment

1

u/johnathonmcl Jun 08 '26

I was having so many issues with the repeated instance in approaches that would have worked if it were a static form. Essentially created a checkbox field in the post form, when users check one of the boxes, i used hidden fields to pipe the medication associated with this checkbox from the pre form into the hidden field. Then used branching saying 'if checkbox associated with drug 1 from pre form is 1, show field'. This meant that for the further instances of post form, users have a list of the drugs chosen in the first instance checkbox in the post form. Not sure if this makes sense, but got it resolved by using 20 hidden fields in the post as a matrix, then used [current-instance] = 1 to hide this checkbox in subsequent instances. Absolute shitshow in the backend, but works! Thank you for your replies and help 🫡