contents.gifindex.gifprev1.gifnext1.gif

About this Guide

The next ten chapters in this guide cover the core DScript language syntax. The last chapter provides a directory of primitives you can use as a reference.

DScript does not support some JavaScript features. In these cases, features were intentionally omitted because they lead to bad programming practices. There are also features of DScript that are not found in JavaScript. These features were added to make it easy to build decision-support applications and to simplify processing of large amounts of data.

Even if you are familiar with JavaScript, you should scan through the following chapters to learn about the differences between JavaScript and DScript.

Examples

This document contains a number of examples that are designed to illustrate particular concepts. You may want to test the examples yourself by entering the example code in DecisionPro or DecisionScript. However, the examples often contain just a few statements that cannot stand alone. To test the code, you will need to expand it to create a complete definition. For example, assume you have the following code:

var y=0;
for(var x=0; x<10; x++)
y+=x;

To test this code you will need to embed it in a definition using the format

Root:={
insert the example code here
}

That is,

Root:={
var y=0;
for(var x=0; x<10; x++)
  y+=x;
}

Once you enter this definition in the tree editor, you can press F9 to execute it.

Some examples include comment text that explains the functions of each line like this:

var y=0; // create a variable named y
for(var x=0; x<10; x++) // set x = 0 to 9
y+=x; // add x to y

When you enter code in the Hierarchical Tree Editor, do not enter the comment text; i.e., everything to the right of //.

Since this document focuses on compound definitions (definitions with more than one statement), you will probably find it most convenient to use the list tree style because it expands definitions rather than displaying them on a single line. To choose this style in the tree editor, click Tree Style in the View menu and then choose the right most style in the Tree Format dialog box.

dph00356.gif

Finally, you might want to alter the example code slightly so that you can view intermediate results. The easiest way to do this is to insert watch statements. For example,

Root:={
var y=0;
for(var x=0; x<10; x++) {
  y+=x;
  watch(x,y);
}
}

The watch primitive will accept any number of arguments and display a dialog box showing the value of each argument. For example, the code above will display the following dialog box on the first pass:

dph00357.gif

  Forecasting Software  |  Strategic Planning Software  |  Decision Support
Decision Tree Software  |  Monte Carlo Simulations  |  Risk Analysis Software
Portfolio Analysis  |  Expert System  |  Online Questionnaires

Contact Us  |  Terms of Use  |  Privacy Policy  |  Site Map
Vanguard Software
© 2008 Vanguard Software Corporation
Forecasting & Planning Solutions
Home Products Solutions Services Customers Partners Company
Vanguard
Applying science to business management
Vanguard
Print this page   Email this page to a friend