PCScript (Server Command) Files

PCScript (Presentation Control Script) is Corda® 7's scripting language. It provides an object-oriented interface for sending data and formatting options to graphs and maps. For more information about PCScript, see PCScript.

The preferred way to send PCScript to Corda Server™ is to store, or dynamically generate, it in a separate file and tell Corda Server the location of this file. There are two primary advantages to this strategy:

A server command file can contain any number of server commands. However, since it is typical to implement almost all server commands with Corda Embedder, the server command file usually contains only PCScript commands. For more information about server commands, see Server Commands

Start a server command file with the @_PCSCRIPT server command, which tells Corda Server that everything that follows is part of the PCScript command string. All PCScript commands follow @_PCSCRIPT.

The two examples below show data from basic server command files. These files are available in <document_root>\examples\command.

Graph Server Command File

@_PCSCRIPT

graph.setCategories(Arrivals; Departures; Unused; Out of Commission)

graph.setSeries(Atlanta; 23; 36; 11; 7)

graph.setSeries(Boston; 41; 17; 25; 9)

Map Server Command File

@_PCSCRIPT

AU.setValues(Background;"New South Wales,2300;Northern Territory,410;Queensland,5710;South Australia,19203;Tasmania,16728;Victoria,7791;Western Australia,4309)

AU.setValues(Cities;Adelaide,23;Brisbane,78;Canberra,1;Darwin,55;Hobart,25;Melbourne,71;Perth,9;Sydney,52)

Use the loadCommandFile() method to tell Corda Server where to find the server command file. This method accepts one parameter: the file name of the server command file. The location string can be a URL, a file name relative to <document_root>, or an absolute file name using the Universal Naming Convention (UNC). For example:

myImage.loadCommandFile("examples/cmd/command1.txt");

Note: In ASP/VBScript, specify a second parameter, which should be set to an empty string.

Important: Make sure Corda Server has permission to read data from the specified path or domain. For more information, see Setting Path Permissions in the Corda 7 Install and Administration manual.