Viewer Commands

A viewer command is an instruction to the viewer to perform a particular action. For example, the ShowLayerList command tells the viewer to display the layer list.

The HTML5 viewer uses the commands in its repertory to implement the features and functions it offers. In addition, you can use viewer commands in hyperlinks and workflows, as described below.

Because commands typically perform a very simple action, the HTML5 viewer sometimes runs several commands one after the other to perform more complex actions.

Some commands need objects or values to work with when performing their action—these objects and values are the command's parameters. The definition of a command specifies how many parameters the command has, the type of each parameter, and whether the parameter is required or optional. For example, the Alert command has two required parameters—the alert's title and message, both strings—and one optional parameter—a function that indicates how the user responded to the alert.

Viewer Commands in Hyperlinks

Viewer commands can be embedded in HTML anchor elements. When the user clicks the hyperlink, the command executes. For example, an anchor element with a call to the ZoomToInitialExtent command in it returns the map to its initial extent when the user clicks the hyperlink.

Viewer commands can be used in the Feature Description and Feature Long Description boxes on a layer's Details tab in Manager—these two boxes can have HTML markup entered in them. To open a layer's Details tab, edit the layer.

You can use any viewer command in feature descriptions and feature long descriptions. For a complete list of available commands, refer to Viewer Commands and Events.

To configure a viewer command in an HTML anchor element, you put command:CommandName in the href attribute, where CommandName is the name of the viewer command. In its simplest form, an anchor element containing a viewer command looks like this:

<a href="command:CommandName">Hyperlink Text</a>

In this case, the viewer command does not have any parameters.

For a command that takes parameters, the command name is followed by a question mark and a query string that specifies the parameters:

<a href="command:CommandName?QueryString">Hyperlink Text</a>

Query strings:

You cannot use Manager's built-in Rich Text Editor to enter viewer commands—you must type them in.

Hyperlinked viewer command in Manager (top) and in the viewer

Examples

Determine if a Command can be Used in Hyperlinks

To determine if a particular command can be used in hyperlinks, find the command in Viewer Commands and Events.

Commands that cannot be used in hyperlinks include a note indicating the limitation in the description area of the command. If there is no such note, then you can safely use the command in hyperlinks.

Viewer Commands in Workflows

The Run External Command workflow activity runs the specified viewer command. This means you can create workflows that use many of the same commands that the viewer itself uses.

For information on the Run External Command activity, refer to the "Activity Library" | "Common Viewer Activities" | "Run External Command" section of the Workflow Designer help system (run Workflow Designer from the Start menu, and then click the help icon in the toolbar).

Determine if a Command can be Used in Workflows

To determine if a particular command can be used in workflows, find the command in Viewer Commands and Events.

Commands that cannot be used in workflows include a note indicating the limitation in the description area of the command. If there is no such note, then you can safely use the command in workflows. Some commands have restrictions on how they are used—these restrictions are also described.

© 2019 Latitude Geographics Group Ltd. All Rights Reserved.

Documentation Version 4.11