MEL Data Symbols 201: Scoring items using getarg and getnargs

It’s not uncommon to want a form component to have the ability to do some scoring.  The scoring might be some kind of risk factors thing; PHQ-9, Falls, and Drug and Alcohol (DAST) screenings are just a few examples.

Sometimes the scoring is a one-to-one relationship where each question is responsible for a point and other times  the scoring might have many-to-one relationship where multiple questions could be responsible for the same point.  In either instance you can use getarg and getnargs within your loop but it’s particularly useful when you’d like to utilize the same fn to do many-to-one style calculations or anytime you’d like to use a function multiple times with varying numbers of arguments.

This is an example form:
getarg2

This is what the scoring code looks like:
getarg1