Script

Executes user-defined JavaScript source code, which is created and edited using the Edit Script Dialog dialog. The Script function contains JavaScript source code (which can be saved and stored as a .js file) that defines its behavior. The source code only defines the behavior for the individual Script function. For example, if there are several Script functions in a job, a variable defined in one Script function is only defined for that particular Script function, and not for all of the Script functions in the job.

Note:
  • The following limits apply to the memory allocated by all Script functions and external script modules used in any given job:

    • The limit for the maximum number of bytes allocated for script memory is 4MB.
    • The limit for the maximum number of bytes allocated for the stack is 64kB.
  • To avoid unnecessary memory allocation, all unused functions needs to be deleted from the script (such as those in the default example script, if they are not used). For example, a script with an unused sample draw function that generates a string object and plots it, consumes memory and CPU cycles.
  • The functionality of a Script function that has been cell stated to disable its execution differs from other Spreadsheet functions. Generally, other Spreadsheet functions retains the last value recorded after the function executed. Any functions that reference the disabled function returns the last value that was recorded. However, due to the Script function requiring the execution of its internal run method, upon loading a disabled Script function, it displays a Script data structure, but any Get function that references it returns #ERR because the Get function is expecting a specific returned value, which is not being returned since the Script function did not execute.