DIAL Language Syntax
The DIAL language syntax is similar to other scripting languages.
A comment begins with two forward slashes ("//") and continues to the end of line.
Examples:
// This script is used to distribute the daily Sales Report
// prodvalue=Total[Actual Units];
// Setting product value
Constants can be numbers or strings.
- Numeric constants can be integer or real, for example, 10 or -1.2
- String constants are enclosed in quotation marks, for example, "This is a string."
A string is a sequence of characters that are enclosed in quotation marks (""). To form a string that contains the quotation mark character, precede the quotation mark by a backslash (\). The backslash defines escape characters. The following table lists the character sequences that can be used in a script.
Character Sequence | Description |
---|---|
\n | New Line |
\r | Carriage Return |
\t | Tab |
\" | Quotation Mark |
\\ | Backslash |
Example:
"Hello there! \n How are you?"
This example displays "Hello there!" on one line, and "How are you?" on the next line as follows:
Hello there!
How are you?
NOTE: DIAL does not span lines within a closed string. If a long string continues to a subsequent line, include a closing quotation mark and a plus sign at the end of the preceding line, and opening and closing quotation marks on the subsequent line.
Example:
This string is a long path name for one file.
"/DiverSolution/TestFiles/Finance/YTD2012/DIAL/"+ "DI_Projects/Models/sample_model_input.dvp"
Use project path names in a script to specify the location of cBases, Models, Markers, and DivePlans, as well as to specify the location of where to save various DiveLine files. When specifying path names, keep the following points in mind:
- Path names are strings enclosed in quotation marks. These strings are case sensitive.
- A forward slash (/) is used to separate folder names.
Project path names are organized as follows:
"/<directory>/<subdirectories>/<file>"
where <directory> is a folder in the declared project space.
Examples:
model.open(myModel, "/models/sales.mdl");
model.open(myModel, "/cbases/finance/revenue.cbase");
marker.save_window(marker, "../temp/window_revbymgrrpt.html", "html");
marker.save_report(mymodel, "../temp/revbymgr.pdf", "pdf,height=10,width=5");
NOTE:
- The paths in the marker.save statements in the examples point to a temp folder in the DiveLine dataroot, which is dl-dataroot/temp.
- Certain DIAL functions are designed to save output or access the local file system where the DIAL client is running and do not work with project paths (for example marker.save_text() and lookup.open()).