Running Scripts from DivePort
Production and DivePort interconnections support event-driven server scripts. You can create prd scripts to run in DivePort when:
- A user logs on
- A user logs off
- A page is displayed or refreshed
- A user selects a particular click action in the portal
The purpose of these event-driven server scripts is to allow the developer to have more control over the freshness of the data presented in the portal. For example, you might want to run a Production script to:
-
Create a new external QuickView Model just before it is needed
-
Read a database or table and create a fresh cBase to support a Marker
-
Take a QuickView selection and rebuild a Model or cBase
-
Perform some cleanup housekeeping tasks after the user departs the Portal
-
Run a Tunnel script at logon prior to displaying the first page:
-
An external QuickView Model needs to be created
-
A database needs to be read and cBases created to support DivePort markers
-
In DivePort, you can:
- Configure portal level scripts from ADMIN > Portal settings. A script can be named to run when a user logs on, prior to displaying the first page, and another to run when the user logs off.
- Set page level options from Edit this page > Settings to run a Production script before a Page loads.
- Configure different portlet types from Edit > Edit portlet > Click Actions to include a Run DI-Production Script. Such an action needs to be manually selected by the DivePort user.
In each of these instances, the path to the script needs to include the project name. The format, which could include a run configuration, is:
project://<project-name>/<directory>/<scriptname>.prd ?runconfig=<runconfig>
For example:
project://birthday_update/programs/birthdays.prd
NOTE:
- When DivePort runs a Production script, it passes along portal variables including QuickView selections. If the DivePort hosts a Measure Factory, the following QuickViews are also passed to Production: _Time Range, _Current Date, _Calendar. As the go-between, the DiveLine server passes _USER and _diveline_dataroot.
- Production can set QuickView values in DivePort by using the dive-key parameter on the DivePort URL.
- If you are using tables or document libraries, in order for the Production script to access files in the DivePort webdata directory, create a system alias in the project. See Aliases Tab.
- Production scripts are configured by an administrator, and are run as an administrative user. The scripts run even if the user who is logged on to the DivePort is not an administrator and does not have the required project access settings. This is by design. However, the script does receive the logged-on user's name as a parameter. Therefore, the script could be coded to make decisions based on that information.
- When run, if the Production script takes some time to run, DivePort shows the loading indicator (the wavy DI pyramid) to let the user know that the script is running on the server.
See