Hi! New to triggers in Caspio. Thank you ahead of time for any assistance you can provide.
I have a table of PARTICIPANTS (patients) and I am enrolling them into research STUDIES. Each study has EVENTS associated with it.
Table 1: Participant
Field 1: Participant ID
Field 2: Participant Name
Table 2: Study
Field 1: Study ID
Field 2: Study Name
Table 3: PEventFinal (Events associated with each study)
Field 1: PEventFinal ID
Field 2: Study ID
Field 3: Event Name
I enroll patients onto a study through a datapage to a 4th table.
Table 4: PartStudy
Field 1: PartStudy ID
Field 2: Participant ID
Field 3: Study ID
The problem I have is when I try to associate the study EVENTS with the PARTICIPANT enrolled in the STUDY. The number of events for each study varies. Some studies can have 2 events, some studies can have 30. I would like to create a trigger on the PartStudy Table that creates a record in a 5th table that list of of the study EVENTS for that PARTICPANT on that PARTICULAR study.
Talbe 5: PartSTudyEvents
Field 1: PartStudyEvent ID
Field 2: PartStudy ID (as text)
Field 3: Participant ID (as text)
Field 4: Study ID (as text)
Field 5: Event Name
I have created a trigger (see below) that inserts the correct number of records into table 5, but inserts the first EVENT only multiple times.
IN the example of Study A, there is a total of 3 events. When I enroll Particpant #1 on Study A, I want the following records to be created in Table 5.
Participant #1, Study A, Tissue Sample
Participant #1, Study A, Blood Draw
Participant #1, Study A, Xray
But what I get is this:
Participant #1, Study A, Tissue Sample
Participant #1, Study A, Tissue Sample
Participant #1, Study A, Tissue Sample
I've read every post I can find on looping and If/Then and inserting multiple records. I'm not a coder so I'm stumped. I'm sure the answer is right in front of my nose, I just haven't quite gotten there.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
kcastagnaro
Hi! New to triggers in Caspio. Thank you ahead of time for any assistance you can provide.
I have a table of PARTICIPANTS (patients) and I am enrolling them into research STUDIES. Each study has EVENTS associated with it.
Table 1: Participant
Table 2: Study
Table 3: PEventFinal (Events associated with each study)
I enroll patients onto a study through a datapage to a 4th table.
Table 4: PartStudy
The problem I have is when I try to associate the study EVENTS with the PARTICIPANT enrolled in the STUDY. The number of events for each study varies. Some studies can have 2 events, some studies can have 30. I would like to create a trigger on the PartStudy Table that creates a record in a 5th table that list of of the study EVENTS for that PARTICPANT on that PARTICULAR study.
Talbe 5: PartSTudyEvents
I have created a trigger (see below) that inserts the correct number of records into table 5, but inserts the first EVENT only multiple times.
IN the example of Study A, there is a total of 3 events. When I enroll Particpant #1 on Study A, I want the following records to be created in Table 5.
But what I get is this:
I've read every post I can find on looping and If/Then and inserting multiple records. I'm not a coder so I'm stumped. I'm sure the answer is right in front of my nose, I just haven't quite gotten there.
Any help would be greatly appreciated!
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.