ProcScript for Dynamic Server Pages

Some ProcScript instructions are specific to web applications (including static server pages). There are also some that are unique to dynamic server pages. They are used to read data into the component, and generate responses to be sent to the client, and to activate ProcScript modules on the client or the server.

Web- and DSP-Specific ProcScript Instructions
ProcScript Instruction Explanation
callfieldtrigger Explicitly calls a named trigger (Detail, Help, Menu, or an extended trigger) for the specified field. For more information, see callfieldtrigger.
javascript, endjavascript Defines a block of JavaScript code in a weboperation or webtrigger.For more information, see javascript.
reconnect Reconnects data loaded from an XML stream with the occurrences in a database or component. It can check whether a field is read-only, and if it is, ignores user modifications and restores the field value from the database. For more information, see reconnect.
scope Specifies the data that is to be included in a dynamic request-response exchange. For more information, see scope.
web Determines whether the trigger or operation in which the web statement is used can be called from a web browser in a dynamic request-response exchange. For more information, see web .
webactivate Sends an instruction to the browser to invoke an operation that has no parameters. For more information, see webactivate.
webdefinitions Use the current component to load channels in $webinfo. For more information, see webdefinitions.
weblayout Retrieves the layout of the server page component and makes it available in the $webinfo("output") channel. For more information, see weblayout.
webload

Loads data from a JSON stream into a component. For more information, see webload.

webmessage Displays a message in a dialog box in the browser. For more information, see webmessage.
weboperation Defines an operation that will be executed on the client browser. For more information, see weboperation.
websave Creates a JSON stream from the data in a component. For more information, see websave.
websetocc Set the current occurrence according to the information received from the DSP client. For more information, see websetocc.
webtrigger Defines a trigger that will be executed on the client browser. For more information, see webtrigger.
$user Returns the user name used to log on to the Web application.For more information, see $user.
$password Return the encrypted password used to log on to the Web application. For more information, see $password.
$web Checks if the current component was started in a Web context. For more information, see $web.
$webinfo Accesses objects loaded from the HTTP request and all the Web server variables. For more information, see $webinfo.

When used with the authorization mechanism, $user and $password can be used at the application level for security checking. They can also be used in state management, for example, to identify state information stored in a file or in a database table.

The weblayout, webdefinitions and websave instructions are used to populate the $webinfo channels with layout, component definitions, and data.

ProcScript that Behaves Differently in Web Applications
ProcScript Instruction Explanation
edit Ignored in dynamic server pages. For more information, see edit.
fieldsyntax
$fieldsyntax
Supported, but not all syntax codes work in a web environment. For more information, see fieldsyntax and$fieldsyntax .
fileload/web Load files that are uploaded via the browser. For more information, see fileload.
$fieldproperties Apply style formatting to specific fields. For more information, see $fieldproperties.
$occproperties Apply style formatting to specific occurrences. For more information, see $occproperties .
$formtitle Set the web page title displayed in the browser’s window title bar. For more information, see $formtitle.
$putmess Insert the contents of the message frame into the HTML page. For more information, see $putmess.
$text Insert a message into the HTML page. For more information, see $text.

ProcScript Inapplicable in Web Applications

The following types of ProcScript instruction are inapplicable to Web applications:

  • Instructions related to component types other than the server page. For example, $lines is only for report components, $gui and $interactive are only for client/server components.
  • Instructions that are specific to an object that is not supported in server pages. For example, $hide and $inlinemenu are menu-related instructions. Menus are not supported in server pages.
  • Instructions that require some interaction from the user or interactive context to process, such as askmess or $next.
ProcScript that is not Supported in Web Applications
ProcScript Instruction Explanation
askmess

Consider the following code:

askmess "Continue?", "Yes,No"
if($status = 1)
   webgen
else
   putmess "The user doesn’t want to continue."
endif

Before the askmess returns a value in $status, it needs a Yes or No answer from the user. However, the server page waits for the completion of the askmess before it generates a HTML page to the browser. Therefore, it is impossible to get the answer from the end user. The server page waits at this point until the process is terminated by time out.

$curhits Hitlists require a stateful client/server environment. To implement data paging in web applications, the retrieved dataset must have a fixed order, and each request sent to the server must specify where to start fetching the data. For more information, see Data Paging in Web Applications.
$dbocc Hitlists require a stateful client/server environment. If required, you can use the JavaScript API to get information about a specific occurrence. For more information, see getStatus() .
message Use webmessage instead. For more information, see webmessage.
$next $previous Need an interactive context such as the current occurrence. Such a context disappears when a button is clicked to submit the web page.

All other ProcScript instructions can be used in server pages. For example, all the controlling and calculating instructions, such as if, $sin, $date and so on, work in any type of application, including web applications.