'include' Directive

Syntax

//@include "[script-location]script-path"

Description

Specifies a script to load and execute before the script containing the directive is executed. Multiple @include directives are interpreted in the order of their appearance in the script text.

New in package 165 Recursive @include directives are supported: the script to be loaded is parsed for the presence of its own @include directives, which are then interpreted, etc.

New in package 166 Added built-in support for a common pattern of separation client and server sections of the script. Including <script-name>.js now automatically triggers lookup, and, if found, execution of the corresponding <script-name>.client.js / <script-name>.server.js counterpart (depending on the context) immediately after the master script's execution.

Parameters

Parameter Description
script-location Location prefix determining script-path interpretation. Can be one of the following:
  • file:script-path specifies a full path to the script in local file system
  • database:script-path specifies a path to the script in database, relative to Stored Scripts location

    New in package 164.5 Optional, defaulted to database: if omitted.

    New in package 164.5 Support for the file: qualifier has been removed in favor of dynamic shadowing of scripts in the database by the scripts in one or more predefined file system locations; see Dynamic shadowing of include scripts.
script-path Path to the script to load and execute.

Dynamic shadowing of include scripts

  • Scripts placed into <Application Server>/files/<database-name>/stored-files/scripts directory will automatically shadow identically named stored scripts in the <database-name> database (default <Application Server> location is %PROGRAMFILES(X86)%\MetaCommunications\Application Server).
  • Further alternative script lookup location(s) can be specified by creating .<database-name>.ini file in the <Application Server>/files directory, with the content along the following lines:
  • [package:...] directives can be used to automate repetitive [mapping] directives, in particular the following directive

    is equivalent to the following [mapping] directives:

Examples

The following directive by default includes workflow.v5.js script from the Stored Scripts location in database:

See Also

Directives

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.