Forum Discussion

jbwall's avatar
jbwall
Qrew Member
2 days ago

Pipeline help

I have a parent table called principal investigators (PI) that has a child table called "applications". This is for external users to apply to a grant we are hosting, all the information will come through a form in the applications table. However, I want to pull information from the applications table into the PI table for future querying. 

 

Very simply, users will put in their name, email address, and departmental affiliations which I want to then create a record in the PI table if it does not exist. If it does exist, I want to update the applications table with the related PI record ID. I cannot get this to trigger properly and I have tried many times. It fails at the IF/ELSE statement. Here is my YAML file below if it helps (I removed identifying information): 

# Add PI to table
#

# Account slugs:
# - quickbase[DB]: Realm Default Account <None>
---
- META:
name: Add PI to table
enabled: false
- TRIGGER quickbase[DB] record on_create -> a:
inputs-meta:
allow_triggers: Any
export_fields: '"Applicant Name, Applicant Email, Departmental Affiliations,
Related Investigator" <6, 9, 81, 234>'
table: '"Awards Portal: Applications" <##>'
- QUERY quickbase[DB] record search -> b:
inputs-meta:
export_fields: '"Email Address, Full Name" <7, 6>'
table: '" Awards Portal: Principal Investigators" <##>'
name: Search for records in PI table
note: Search for records in PI table that match the applicant email
- b<>LOOP:
- DO:
- IF:
- AND:
- a<>applicant_email equals {{b.email_address}}
- THEN:
- a<>ACTION quickbase record update -> c:
inputs:
related_investigator: '{{b.id}}'
name: Update the record
note: This step updates a record in the table
- ELSE:
- ACTION quickbase[DB] record create -> d:
inputs-meta:
export_fields: '"Affiliations, Email Address, Full Name" <8, 7, 6>'
table: '"Awards Portal: Principal Investigators" <DB>'
inputs:
affiliations: '{{a.departmental_affiliations}}'
email_address: '{{a.applicant_email}}'
full_name: '{{a.applicant_name}}'
name: Create the record
note: This step creates a record in the table
- a<>ACTION quickbase record update -> e:
inputs:
related_investigator: '{{d.id}}'
name: Update the record
note: This step updates a record in the table
- metadata:
name: If a condition is met, do something
note: Check if condition is true
- metadata:
name: Iterate through the records
note: Iterate through the records found in the previous step
... 

1 Reply

  • Just trying to understand the problem space. Are you saying that the first applicant automatically becomes the primary investigator? Why not have the form on the PI table? Apologies, not necessarily questioning your approach, just trying to understand. What will happen to subsequent applicants?