About scripts in Mongoose-based applications

The Mongoose framework exposes a set of interfaces that provide programming support for most facilities within Mongoose-based applications. You can make use of these APIs by writing scripts that encapsulate code written in Microsoft Visual Basic or in C#.

In Mongoose, scripts can either be global objects or they can be specific to a validator, a form event handler, or a form.

  • Validators are global objects that can incorporate scripts. You can incorporate a short script inside a validator's specifications by creating an Inline Script validator. In this case, the script is stored in the forms database as part of the validator global object. Or you can reference an external script by creating a Run Script validator. A script referenced by a Run Script validator is stored as a separate global object in the forms database and can be referenced elsewhere.
  • Form event handlers are defined for specific forms and can incorporate scripts. You can incorporate a short script inside an event handler's specifications by creating an event handler with an Inline Script response type. In this case, the script is stored in the forms database as part of the event handler's portion of the form definition. Or you can reference an external script by creating an event handler with a Run Script response type. A script referenced by a Run Script response type is stored as a separate global object in the forms database and can be referenced elsewhere.
  • Form scripts are scripts that are defined for particular forms and apply only to those forms. Form scripts are stored as part of the form definition in the forms database and cannot be referenced elsewhere.

Script objects

Mongoose scripts utilize methods and properties associated with four basic kinds of objects:

In addition, Mongoose provides a property and two methods that are not associated with any of these objects:

  • The ThisForm property can be used with both global scripts and form scripts.
  • The GetParameter method and the CountParameter method are available only within global scripts.

Procedures and parameters

All global scripts and inline scripts must contain at least one procedure of type Sub or Function with the procedure name of Main. No parameters can be passed to the Main() procedure as command arguments. A global script can have more than one procedure. Other procedures can be named by any valid Visual Basic or C# name.

Only the Main() procedure in any global script can be called from WinStudio. This is the procedure called when the script name is invoked from within Mongoose.