Basics of JavaScript

Basic Code

Symbol Meaning
== equals
!= not equals
|| or
&& and
> greater than
>= greater than or equal to
< less than
<= less than or equal to
() brackets control order of execution
. a period indicates a property of something
Case JavaScript is case-sensitive (i.e. capitalization matters!)

 

Script Variables

Variable

Description

Example Expression

pt

The ScriptPatient object with age, sex, etc.

pt.isMale() && pt.getAge() >= 55

See this article for more details about more 'pt.' expressions.

daysSinceLastCompleted

The number of day since the patient last complete this form

daysSinceLastCompleted > 365

firstTime

Whether or not the patient has ever completed this form

firstTime

lastCompletedTag

A string “remembered” by the form last time it was completed

lastCompletedTag.indexOf('myString') != -1

 

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

Please refer to this article for examples of common ScriptUtil functions.

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