DAS Script Variables, Expressions and Commands
Read the language one statement at a time.
Three different things on one line
$fePrice = 12.5; assigns a user variable. Price=12.5; writes a Montage field in the applicable context. MsgBox($fePrice); calls a function. Similar-looking text can have very different effects.
A semicolon separates statements. Use plain ASCII quotes for string literals and // for comments. PDF typography can turn quotes into characters that are not valid source code.
A calculation you can check by hand
Advanced Script · calculation and message only. All numbers are fictional lesson inputs.
$feUnits = 24;
$feUnitPrice = 7.5;
$feNotional = $feUnits * $feUnitPrice;
MsgBox($feNotional);
The expected value is 180. Change only $feUnits to 32; the new result should be 240. This isolates arithmetic from market data and order entry.
| Construct | Meaning | Check |
|---|---|---|
$feUnits = 24 |
Assign an integer | A new value replaces the old value |
$feUnitPrice = 7.5 |
Assign a decimal | Do not confuse dollars and cents |
"feMontage" |
Literal text | Quotes belong around the name |
$feWindow.BID |
Read an object property | Resolve the object first |
MsgBox(...) |
Display values | The dialog needs user interaction |
The guide documents integer, float, string and object values. It also states that multiplication and division precede addition and subtraction. Use parentheses when the intended grouping matters.
Lab: distinguish a value from a field
Write down which of the three opening examples changes the Montage. Then calculate (24 + 8) * 7.5 on paper before encoding it. Keep platform commands in a separate block from pure calculations so you can review their effects independently.
Read the evaluation sequence
In $feNotional = $feUnits * $feUnitPrice;, read the two current values on the right, multiply, then replace the value on the left. Assignment does not install a reactive formula: changing $feUnits later does not recompute the stored notional. Execute the calculation again when a new result is needed.
Advanced Script · fixed numbers and messages, no window writes.
$feUnits = 24;
$feUnitPrice = 7.5;
$feNotional = $feUnits * $feUnitPrice;
$feUnits = 32;
MsgBox("Stored: ", $feNotional);
$feNotional = $feUnits * $feUnitPrice;
MsgBox("Recomputed: ", $feNotional);
Expect 180 followed by 240. This also distinguishes a saved quote snapshot from a new quote read: an old number does not automatically follow the market.
Text, numbers and objects
"24" is a text literal and 24 an integer; do not depend on unverified implicit conversion. A window object is not its name string: "feMontage" is a lookup argument, while GetWindowObj("feMontage") performs the lookup. Displaying an object with ShowObject() does not establish a return value equal to that object.
Conditions, rounding and text input each have their own semantics. Use documented operators rather than importing JavaScript arrays, arrow functions, try/catch, === or Math.floor because braces look familiar. Continue with Input and validation, Numeric models and NewUserObj for DAS-specific patterns.
Worked answers
Of the opening examples, only Price=12.5; writes a Montage field. (24 + 8) * 7.5 is 240; removing parentheses gives 24 + 8 * 7.5, or 84. Write the expected result first. Absence of an error is not a sufficient assertion.