ScriptUtil Functions

ScriptUtil provides miscellaneous functions that allow you to simplify your scripts and support special use-cases. ScriptUtil is bound to all script session contexts, so you can use these functions in tablet rules or within eForms (show if, make note if, etc.).

Variable(s) Description & Example Expression

sum, max, min

Returns the sum/max/min of point values in the section

ScriptUtil.sum(section1Ref) > 10
Copy Example

countAnswersMatching, countAnswersWithPointsEqualTo

The number of answers matching the value or point value in the specified section

ScriptUtil.countAnswersMatching(mySection,'other') > 0
Copy Example


Returns a number between 0 and 100 representing the number of completed items in a section (including nested sections)

ScriptUtil.percentComplete('nutriSTEPQs') == 100
Copy Example


Provides access to any keyword. Used for CPP access and a ‘catch-all’ for access to patient information.

ScriptUtil.getKeyword('@ptClinicDoc') == 'John Smith'
Copy Example


Provides access to an answer provided on a previous EForm in the same session.

ScriptUtil.getResponse('mySmokingScreenForm','isCurrentSmoker') == 'Y'
Copy Example


(supported on Ocean Tablet only)

Returns true if the form queue (or completed forms) contains the ref passed in.

Copy Example


(supported on Ocean Tablet only)

Returns the number of forms in the queue plus any forms that have already been completed.

ScriptUtil.queueSize() == 0
Copy Example


Accepts a date string in "yyyy-mm-dd" format and returns a Javascript Date (tablet v127+)

Copy Example


Displays sections or items for web questionnaires only, not tablets.

Copy Example


Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request