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.
Example 1: Salary & Fringe Calculations +
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 / 100}}
- field5 = {{field4 * field3 / 100}}
- field6 = {{field4 + field5}}
Result:
- Salary Requested = $25,000
- Fringe Requested = $7,500
- Total Personnel Costs = $32,500
Example 2: MTDC Indirect Cost Calculation +
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)
Expressions:
- field4 = {{field2 25000 ? field1 - field2 + 25000 : field1}}
- field5 = {{field4 * field3 / 100}}
Example A: Direct Costs = $150,000, Subaward = $60,000, F&A = 50%
- Since 60,000 25,000 is true, use the first expression: 150,000 − 60,000 + 25,000 = 115,000
- Indirect Costs = 115,000 × 50 / 100 = $57,500
Example B: Direct Costs = $150,000, Subaward = $10,000, F&A = 50%
- Since 10,000 25,000 is false, use the second expression: 150,000 (subaward ≤ $25k, so fully included)
- Indirect Costs = 150,000 × 50 / 100 = $75,000
Example 3: Cost Sharing Requirements +
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 / 100}}
Result:
- Institutional Cost Share = $40,000
Example 4: Multi-Period Budget Rollup +
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
Example 5: Escalating Salary Projections +
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
Example 6: Participant Support Stipends +
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
Example 7: Concatenating Fields +
Scenario 7a: 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)
Scenario 7b: 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
Example 8: If/Then/Else Logic +
Scenario 8a: 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 = {{ field1 250000 ? "Non-Modular" : field1 0 ? "Modular" : "" }}
This returns "Non-Modular" when Total Direct Costs $250,000, "Modular" when $250,000 ≥ Total Direct Costs $0, and blank when Total Direct Costs ≤ $0.
Result: Non-Modular
Scenario 8b: 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 = {{ field2 == 'Federal' ? field1 * field3 / 100 : field2 == 'Industry' ? field1 * field4 / 100 : "" }}
This multiplies by the appropriate rate if Sponsor Type is "Federal" or "Industry", and leaves Indirect Costs blank if Sponsor Type is not answered or is set to another value.
- Result (Federal): $50,000
- Result (Industry): $60,000
Scenario 8c: Apply fringe only if effort 0%.
Fields:
- Effort % (field1)
- Salary (field2)
- Fringe Rate (field3)
- Fringe Costs (field4)
Expression:
- field4 = {{ field1 0 ? field2 * field1 / 100 * field3 / 100 : 0}}
Results:
- Effort = 0% → Fringe Costs = $0
- Effort = 25% (Salary = $100,000) → Fringe = $7,500
Example 9: Compliance Risk Rating +
Scenario: Automatically assign a risk level based on multiple compliance-related answers.
Fields:
- export_control_flag (checkbox)
- pi_prior_noncompliance (checkbox)
- foreign_component_flag (checkbox)
- human_subjects_risk (Clinical Trial, Full Board, Expedited)
- undisclosed_coi_flag (checkbox)
- Risk Score (field6)
- Risk Rating (field7)
Expressions:
Risk Score:
- field6 = {{ (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 }}
The weighting factors (3, 2, 1, 0) can be adjusted to reflect your institution's desired risk priorities.
Risk Rating:
- field7 = {{ field6 = 5 ? "High" : field6 = 3 ? "Medium" : field6 0 ? "Low" : "" }}
The Risk Rating field remains blank until the Risk Score has been calculated.
Results:
- Case 1: Export control (3 pts) + prior noncompliance (3 pts) → Risk Score = 6 → High
- Case 2: Full Board IRB (2 pts) + foreign component (2 pts) → Risk Score = 4 → Medium
- Case 3: Expedited IRB review only (1 pt) → Risk Score = 1 → Low
Example 10: Clinical Trial Budgets +
Scenario: 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):
- Startup 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
Expressions:
- FOA Maximum Budget: field8 = {{field1 + field2 + field3 + (field4 * field5) + field7}}
- Realistic Enrollment Budget: field9 = {{field1 + field2 + field3 + (field4 * field6) + field7}}
Results:
- FOA Budget (100 patients) = $23,000
- Realistic Budget (60 patients) = $17,000
Best Practices:
- Retain IDs and Short Labels when replacing form objects with expression fields so reporting remains consistent. See Replacing Form Objects with Expression Field Objects.
- Use Preview Mode to validate that expressions return expected results before publishing.
Best Practices
- 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.