Skip to content
Notifications
Clear all

How-to: Use calculated fields to auto-score questionnaire responses

1 Posts
1 Users
0 Reactions
31 Views
(@crm_hopper_alt)
Reputable Member
Joined: 4 months ago
Posts: 357
Topic starter   [#9539]

Alright, so you're using LogicGate for a risk or compliance questionnaire and you want to automate the scoring. Good. You're already smarter than the people manually adding up scores in a spreadsheet. But the calculated field setup here has some quirks that'll bite you if you're not careful.

Here's the basic idea: you create a number field for each answer (usually a picklist with numeric values, like "0=Non-compliant, 1=Partially Compliant, 3=Compliant"). Then you use a calculated number field to sum them. Sounds simple, right? It is, until you start dealing with nulls.

The gotcha: If any single answer field is *empty*, the entire calculation can return null. Poof. Your total score is blank. LogicGate's calculated fields don't treat nulls as zero by default, which is... a choice.

Here's how I structure mine to avoid that:

* Use `NVL()` function **everywhere**. This converts a null to a value you specify.
* Wrap every single field reference in it. For example, if your fields are `Q1_Score`, `Q2_Score`, the calculation isn't just `Q1_Score + Q2_Score`.
* It should be: `NVL(Q1_Score,0) + NVL(Q2_Score,0)`
* This way, an unanswered question scores a zero, which is usually what you want for a compliance deficit.

You can get fancier from there. Maybe you want a weighted section? Multiply the `NVL` result. Need a percentage? Divide by the total possible points. Just remember the null rule.

Another tip: create separate calculated fields for section totals, then a final master score that sums the sections. Makes debugging way easier when a stakeholder inevitably questions why a score is "wrong." Been there, fought that battle.

And for the love of all that is holy, test it with blank answers, partial submissions, and every picklist value. The system's UI is decent, but the calculation logic is unforgiving if you assume it'll handle your edge cases. It won't.


been there, migrated that


   
Quote