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

percentComplete

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

getKeyword

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

getResponse

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

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

queueContains

(supported on Ocean Tablet only)

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

ScriptUtil.queueContains('phq9')
Copy Example

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
Copy Example

parseDate

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

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

webQ

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

ScriptUtil.isWebQ()
Copy Example

 

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