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.).



Example Expression

sum, max, min

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

ScriptUtil.sum(section1Ref) > 10

countAnswersMatching, countAnswersWithPointsEqualTo

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

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


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

ScriptUtil.percentComplete('nutriSTEPQs') == 100


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

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


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

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


(supported on Ocean Tablet only)

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



(supported on Ocean Tablet only)

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

ScriptUtil.queueSize() == 0


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



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



Learn More 

1. Getting Started with eForms 10. Action Menu - eForm Actions
2. Creating a New Form & Understanding Form Structure 11. Adding Hyperlinks to eForms
3. Adding eForm Items - General Tab 12. Editing an Existing Form
4. Editing Menu Choices 13. Helpful eForm Formatting Tips
5. Note Formatting for Items 14. Form Memory - Storing Form Values for Patients in Ocean
6. Using Keywords to Automatically Insert Content 15. Basics of Java Script
7. Adding a Section - Overview 16. Formula Scripting
8. Scripting & More Tab Basics 17. Advanced JavaScript in Forms ("Fancy Stuff")
9. Action Menu - eForm Properties 18. ScriptPatient ("Pt") Functions


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