VDL Expression Language Syntax
Expressions are case sensitive - Return and return refer to different objects.
scenario.entities.Return.valuegives access to the entities property of the scenario object. This in turn is also an object, and the second dot provides access to the Return property of the entities object.
Array Access
scenarios[1]When you dereference a Mosel array entity within a VDL expression, you will need to follow an established rule - because array entities can have multiple indices they cannot be treated as plain arrays, and you need instead to call the array name as a function, passing the indices as parameters.
scenario.entities.MyArray(0).value
<span vdl-text="=scenario.entities.MyArray(0) ? scenario.entities.MyArray(0).value : ''"></span>
Function Calls
Functions of the VDL expression language can be written inline or within script blocks.
<vdl-validate pass="=function(entity,value) { return value > 100; }"> </vdl-validate>
![]() |
Note See
Using Validators for information about the
<vdl-validate> element.
|
<script> function MyFunc (entity, value) { return value < 10; } </script> <vdl-validate pass="=MyFunc"></vdl-validate>This method provides more space in which to write what might be a more complex function, it can be read and understood more clearly and permits sharing among many VDL elements if needed.
String Demarcation
<vdl-column vdl-text="='a'+'bb'+'ccc'"></vdl-column>The code snippet above would return the value as ' abbcc'.
Key-value pairs
<div vdl-css="hilite: true, showing: false"></div>The symbol before a colon is called a key, anything after it (up until the end of the attribute string or the next comma) is the value. These are treated as evaluated expressions. If a chosen key contains anything other than alphanumeric characters (a-z, A-Z and 0-9) then the key itself must be placed inside quotes. To avoid clashing with the attribute quotes, use single quotes:
<div vdl-css="'hilite-item': true, 'showing-item':false"></div>Similarly, when the value is a string, for the same reason, enclose it in single quotes.
Arithmetic and Comparision (Boolean) Operators
Operator | Name | Example |
---|---|---|
+ | add | 2+2 = 4 |
- | unary negative | -10 |
- | subtract | 12 - 7 = 4 |
* | multiply | 8 * 7 = 56 |
/ | divide | 20/4 = 5 |
% | remainder | 20 % 7 = 6 |
< | less than | 3 < 6 |
<= | less than or equal to | 5 <= 10 |
> | greater than | 17 > 1 |
>= | greater than or equal to | 20 >= 20 |
== | roughly equal to | 3 == '3' |
!= | roughly not equal to | 4 != '4' |
=== | strictly equal | 6 === 6 |
!== | strictly not equal to | 6 !== '6' |
![]() |
Note If in doubt, use the strict comparisons. Use of the roughly equal/not equal operators can lead to unexpected matches.
|
Logical Operators
Operator | Name | Example |
---|---|---|
! | not | !false === true |
&& | logical and | True && !true === false |
|| | logical or | false || true === true |
© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.