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

Description

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

percentComplete

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

ScriptUtil.percentComplete('nutriSTEPQs') == 100

getKeyword

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

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

getResponse

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

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

queueContains

(supported on Ocean Tablet only)

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

ScriptUtil.queueContains('phq9')

queueSize

(supported on Ocean Tablet only)

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

ScriptUtil.queueSize() == 0

parseDate

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

ScriptUtil.parseDate("2015-3-5")

webQ

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

ScriptUtil.isWebQ()

 

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