Expression fields in the Advanced Form Builder (AFB) allow you to perform calculations directly in form fields. This is especially powerful in research budgeting scenarios or compliance checks, where complex formulas often need to be applied consistently across records.
This article provides real-world examples of how expression fields can automate calculations such as salary effort, fringe benefits, indirect costs, cost sharing, and multi-period totals.
Scenario: A PI requests 25% effort on a project, with fringe benefits applied at 30%.
Fields Used:
- Annual Base Salary (field1) = 100,000
- Percent Effort (field2) = 25%
- Fringe Rate (field3) = 30%
- Salary Requested (field4)
- Fringe Requested (field5)
- Total Personnel Costs (field6)
Expressions:
field4 = {{field1 * field2}}
field5 = {{field4 * field3}}
field6 = {{field4 + field5}}
Result:
- Salary Requested = $25,000
- Fringe Requested = $7,500
- Total Personnel Costs = $32,500
Scenario: NIH caps indirect cost recovery at the first $25,000 of each subaward.
Fields Used:
- field1 = Direct Costs (total, including subaward)
- field2 = Subaward Amount
- field3 = F&A Rate
- field4 = MTDC Base (Expression Field)
- field5 = Indirect Costs (Expression Field)
Step 1 — Create Helper Fields
-
Subaward Over 25k (Expression Field)
- Formula: field2 > 25000
- Returns true if the subaward is larger than $25,000.
-
MTDC Case: Subaward ≤ 25k
- Formula: field1
- Meaning: If the subaward is $25,000 or less, include it fully in the MTDC base.
-
MTDC Case: Subaward > 25k
- Formula: field1 - field2 + 25000
- Meaning: Remove the portion of the subaward above $25,000.
Scenario: Institution commits to a 20% cost share.
Fields Used:
- Sponsor Direct Costs (field1) = $200,000
- Cost Share % (field2) = 20%
- Institutional Cost Share (field3)
Expression:
field3 = field1 * field2
Result:
Institutional Cost Share = $40,000
Scenario: A project spans 3 years with separate period budgets.
Fields Used:
- Period 1 Direct Costs (field1) = $100,000
- Period 2 Direct Costs (field2) = $110,000
- Period 3 Direct Costs (field3) = $120,000
- Cumulative Direct Costs (field4)
Expression:
field4 = {{field1 + field2 + field3}}
Result:
Cumulative Direct Costs = $330,000
Scenario: Salaries escalate by 3% annually.
Fields Used:
- Base Year Salary (field1) = $80,000
- Escalation Rate (field2) = 3%
- Year 2 Salary (field3)
- Year 3 Salary (field4)
Expressions:
field3 = field1 * {{1 + field2/100}}
field4 = field3 * {{1 + field2/100}}
Result:
- Year 2 Salary = $82,400
- Year 3 Salary = $84,872
Scenario: A program funds stipends for multiple participants across multiple sessions.
Fields Used:
- Number of Participants (field1) = 10
- Stipend per Participant (field2) = $500
- Number of Sessions (field3) = 4
- Total Participant Support (field4)
Expression:
field4 = {{field1 * field2 * field3}}
Result:
- Total Participant Support = $20,000
7a. Scenario: Automatically create a reporting-friendly field that combines project title and PI name.
Fields:
- Project Title (field1) = “Climate Impact Study”
- PI Last Name (field2) = “Nguyen”
- Project Display Name (field3)
Expression:
field3 = field1 + " (" + field2 + ")"
Result:
Climate Impact Study (Nguyen)
7b. Scenario: Concatenate sponsor, award number, and fiscal year into one identifier.
Fields:
- Sponsor Code (field1) = “NSF”
- Award Number (field2) = “12345”
- Fiscal Year (field3) = “2025”
- Combined Award ID (field4)
Expression:
field4 = field1 + "-" + field2 + "-" + field3
Result:
NSF-12345-2025
8a. Scenario: Flag whether a project is modular or non-modular based on cost threshold.
Fields:
- Total Direct Costs (field1) = 300,000
- Budget Category (field2)
Expression:
field2 = if(field1 > 250000, "Non-Modular", "Modular")
Result:
Non-Modular
8b. Scenario: Apply different indirect cost rates depending on sponsor type.
Fields:
- Direct Costs (field1) = $100,000
- Sponsor Type (field2) = “Federal” or “Industry”
- Federal F&A Rate (field3) = 50%
- Industry F&A Rate (field4) = 60%
- Indirect Costs (field5)
Expression:
field5 = if(field2 == "Federal", field1 * field3, field1 * field4)
Result (Federal): $50,000
Result (Industry): $60,000
8c. Scenario: Apply fringe only if effort > 0%.
Fields:
- Effort % (field1)
- Salary (field2)
- Fringe Rate (field3)
- Fringe Costs (field4)
Expression:
field4 = if(field1 > 0, (field2 * field1) * field3, 0)
Result:
- Effort = 0 → Fringe = $0
- Effort = 25% (Salary = $100k) → Fringe = $7,500
Scenario: Automatically assign a risk level based on multiple compliance-related answers.
Use additive logic with comparisons, following the equals/any-answer patterns documented in AFB: https://support.cayuse.com/hc/en-us/articles/33779194076563-Advanced-Form-Builder-Display-Ignore-Logic
( (export_control_flag == "Yes" ? 1 : 0) * 3 ) +
( (pi_prior_noncompliance == "Yes" ? 1 : 0) * 3 ) +
( (foreign_component_flag == "Yes" ? 1 : 0) * 2 ) +
( human_subjects_risk == "Clinical Trial" ? 3 :
human_subjects_risk == "Full Board" ? 2 :
human_subjects_risk == "Expedited" ? 1 : 0 ) +
( (undisclosed_coi_flag == "Yes" ? 1 : 0) * 2 )
Step 2 — Risk Rating (Visible fields)
Create three labels (e.g., Information objects) and gate their visibility with boolean expressions:
- High:
{{ risk_score >= 5 }}
- Medium:
{{ risk_score >= 3 && risk_score < 5 }}
- Low:
{{ risk_score < 3 }}
Results
Here’s how the rating would look in practice:
-
Case 1: A study flagged for export control (3 points) and prior noncompliance (3 points).
- Risk Score = 6
- Risk Rating = High
-
Case 2: A study with Full Board IRB review (2 points) and a foreign component (2 points).
- Risk Score = 4
- Risk Rating = Medium
-
Case 3: A study with no export control, no foreign component, and expedited IRB review (1 point).
- Risk Score = 1
Risk Rating = Low
Clinical trial budgets often include one-time fees, per-patient reimbursements, and either percentage-based or flat indirect costs. Expression fields allow you to capture these parameters at a high level and easily generate both the FOA maximum and realistic enrollment scenarios.
Example Parameters (Pfizer FOA):
- Start-Up Costs = $5,000 (one-time)
- Data Storage = $1,000 (one-time)
- Study Closeout = $2,000 (one-time)
- Per-Patient Reimbursement = $100
- Indirect Costs (flat) = $5,000
- Planned Enrollment = 100 patients
- Realistic Enrollment = 60 patients
Fields
- field1 = Startup Costs
- field2 = Data Storage Costs
- field3 = Closeout Costs
- field4 = Per-Patient Reimbursement
- field5 = Planned Patients (from FOA)
- field6 = Realistic Patients (institution assumption)
- field7 = Indirect Costs (flat)
- field8 = FOA Budget (max)
- field9 = Realistic Budget
- Retain IDs and Short Labels when replacing form objects with expression fields to maintain consistent reporting. Learn more in the linked article.
- Use Preview Mode to validate that expressions return expected results before publishing.