Evaluations - AppDaddy-Software-Solutions-Inc/framework-markup-language GitHub Wiki
Evaluations are simply a string of one or comma ";" separated events or widget *method calls. Evaluations can contain widget bindings as parameters.
Evaluations always start with the equals "=" when specfied as a widget attribute. Widget events are always treated as *evaluations and can omit the equals prefix.
All events or widget *method calls have a return value of *boolean. When an evaluation string contains more than one event or method call, each is evaluated in turn. If a evaluation returns false, the evaluation terminates immediately and returns.
Name | Type | Description |
---|---|---|
+ | addition | Adds to operands. |
- | subtraction | Subtracts to operands. |
* | multiplication | Multiplies to operands. |
/ | division | Divides two operands. |
! | Logical Negotiation | Returns the reversed meaning of operand. |
?? | Null Aware |
left ?? right returns right if left is null. |
|| | Logical OR | Returns true if either or both operands are true, returns false otherwise. |
&& | Logical AND | Returns true if both operands are true, returns false otherwise. |
| | Binary OR | Preforms bitwise OR on two operands. |
^ | Binary XOR | Preforms bitwise XOR on two operands. |
& | Binary AND | Compares each bit of the first operand to the corresponding bit of the second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0. |
== | Equal To | Returns true if left equals right. |
!= | Not Equal To | Returns true if left does not equal right. |
<= | Less Than or Equal To | Returns true if left is less than or equal to right. |
>= | Greater Than or Equal To | Returns true if left is greater than or equal to right. |
< | Less Than | Returns true if left is less than right. |
> | Greater Than | Returns true if left is greater than right. |
<< | Left Shift | Shifts a binary representation to b bits to left and inserting 0 from right. |
>> | Right Shift | Shifts a binary representation to b bits to left and inserting 0 from left. |
% | Modulus | Gives the remainder of two operands. |
Logical | |
case
(
|
Attempts to match the binding value to a case value and returns a value from that case |
if
(
|
If value is true return value2, otherwise value3 |
isNull
(
|
If value is null return true, otherwise false |
isPhone
(
|
Converts value to a string and returns true if value is formatted in a valid phone number format, otherwise false |
isCard
(
|
Converts value to a string and returns true if value is formatted in a valid credit card format, otherwise false |
isEmail
(
|
Converts value to a string and returns true if value is formatted in a valid email address format, otherwise false |
noe
(
|
If value is null or whitespace return true, otherwise false |
nvl
(
|
If value is null return default, otherwise value |
DateTime | |
addTime
(
|
Converts date to a DateTime, adds the amount expressed in plain language time values (ie: 500ms, 1 year, 3 weeks), and returns the date result as a string. |
isBefore
(
|
Converts date1 and date2 to DateTime and returns true if date1 is earlier than date2. |
isAfter
(
|
Converts date1 and date2 to DateTime and returns true if date1 is later than date2. |
subtractTime
(
|
Converts date to a DateTime, subtracts the amount expressed in plain language time values (ie: 500ms, 1 year, 3 weeks), and returns the date result as a string. |
timeBetween
(
|
Converts date1 and date2 to DateTime and returns a time between expressed in plain language time values (ie: 500ms, 1 year, 3 weeks). |
toDate
(
|
Converts value to DateTime using the specified inputFormat and returns the result using the specified outputFormat |
toEpoch
(
|
Converts value to DateTime and returns the number of milliseconds since 1970-01-01T00:00:00Z (UTC). Commonly referred to as Unix time. |
Boolean | |
isBool
(
|
If value is a boolean (true, false, 'true', 'false', '1', '0', 'yes', 'no') return true, otherwise false. |
toBool
(
value
)
→ |
Converts value to boolean. String values "true", "yes" and "1" return true, "false", "no" and "0" return false, othersie null. |
Numeric | |
abs
(
|
Converts value to numeric and returns its absolute value |
acos
(
|
Converts value to numeric and returns its arc cosine |
asin
(
|
Converts value to numeric and returns its arc sine |
atan
(
|
Converts value to numeric and returns its arc tangent |
ceil
(
|
Converts value to numeric and returns the largest integer greater than or equal to the value. |
cos
(
|
Converts value to numeric and returns its cosine |
floor
(
|
Converts value to numeric and returns the largest integer less than or equal to the value. |
isNumeric
(
|
If value is numeric return true, otherwise false. |
mod
(
|
Converts value to numeric and returns the remainder of the value divided by the *divisor* |
number
(
|
Converts value to numeric.
|
pi
→ |
The value pi. |
round
(
|
Converts value to numeric and returns value rounded to the nearest digit before(-) or after (+) the decimal, and adds padding of trailing 0's. |
sin
(
|
Converts value to numeric and returns its sine |
tan
(
|
Converts value to numeric and returns its tangent |
toDouble
(
|
Converts value to a double |
toInt
(
|
Converts value to an integer |
toNum
(
|
Converts value to numeric |
truncate
(
|
Truncates the value to the nearest digit before(-) or after (+) the decimal, and adds padding of trailing 0's. |
String | |
contains
(
|
Converts value to string and returns true if the result contains the pattern, otherwise false. |
decode
(
|
Decodes value from BASE64 to UTF8 |
decrypt
(
|
Decrypts value using the supplied cyptopgraphy key |
encode
(
|
Encodes value from UTF8 to BASE64 |
encrypt
(
|
Encrypts value using the supplied cyptopgraphy key |
endsWith
(
|
Converts value to string and returns true if the result ends with the pattern, otherwise false. |
hash
(
|
Converts value to string and returns the hashed value using the supplied hash key. If key is not supplied, the hask key from config.xml is used. |
join
(
|
Converts value to string and appends value1 through value9 |
length
(
|
If value is a list returns the number of entries in the list, otherwise converts value to string and returns its length |
lpad
(
|
Converts value to string and left pads it to the specified length using the specified character. |
replace
(
|
Converts value to string and returns the result with all matching pattern's replaced with value2 |
rpad
(
|
Converts value to string and right pads it to the specified length using the specified character. |
split(
|
Converts value to string, splits the result using the specified character. If index is not null, returns the value at the specified position in the resulting list, otherwise returns the list. |
startsWith
(
|
Converts value to string and returns true if the result starts with the pattern, otherwise false. |
substring
(
|
Converts value to string and returns the trimmed substring from index fromIndex to toIndex. If toIndex is not suppied, it is assumed to be to the end of the the string. |
toHex
(
|
Converts value to int and then to its base16 hexidecimal equivalent. If add0xprefix is true the result is prefixed with '0x'. The result is returned as a string |
toJson
(
|
Converts value to string and parses the result as json. If valid, the formatted result is returned, otherwise null. |
toLower
(
|
Converts value to string and returns the string with all characters converted to lower case. |
toStr
(
|
Converts value to string |
toUpper
(
|
Converts value to string and returns the string with all characters converted to upper case. |
toXml
(
|
Converts value to string and parses the result as xml. If valid, the formatted result is returned, otherwise null. |
List | |
elementAt
(
|
Returns the element in the list at the specified at index |
indexOf
(
|
Returns the index in the list of the specified object. Null if not in the list. |
toList
(
|
Returns the elements in the list matching the where clause. Note: The where clause need's to be passed as a literal (un-translated) string. This can be achieved using a <BLOB/> variable in place of the actual where and instead paasing a binding to the variable in its place. |
first
(
|
Returns the first element in the list matching the where clause. Note: The where clause need's to be passed as a literal (un-translated) string. This can be achieved using a <BLOB/> variable in place of the actual where and instead paasing a binding to the variable in its place. |
last
(
|
Returns the last element in the list matching the where clause. Note: The where clause need's to be passed as a literal (un-translated) string. This can be achieved using a <BLOB/> variable in place of the actual where and instead paasing a binding to the variable in its place. |
sum
(
|
Returns the sum of all elements in the list for the specified field matching the where clause. Note: The where clause need's to be passed as a literal (un-translated) string. This can be achieved using a <BLOB/> variable in place of the actual where and instead paasing a binding to the variable in its place. |
average/avg
(
|
Returns the average of all elements in the list for the specified field matching the where clause. Note: The where clause need's to be passed as a literal (un-translated) string. This can be achieved using a <BLOB/> variable in place of the actual where and instead paasing a binding to the variable in its place. |
count/cnt
(
|
Returns the count of all elements in the list for the specified field matching the where clause. Note: The where clause need's to be passed as a literal (un-translated) string. This can be achieved using a <BLOB/> variable in place of the actual where and instead paasing a binding to the variable in its place. |
minimum/min
(
|
Returns the minimum of all elements in the list for the specified field matching the where clause. Note: The where clause need's to be passed as a literal (un-translated) string. This can be achieved using a <BLOB/> variable in place of the actual where and instead paasing a binding to the variable in its place. |
maximum/max
(
|
Returns the maximum of all elements in the list for the specified field matching the where clause. Note: The where clause need's to be passed as a literal (un-translated) string. This can be achieved using a <BLOB/> variable in place of the actual where and instead paasing a binding to the variable in its place. |
read
(
|
Reads the value of the first element in the list for the specified field. |
write
(
|
Writes the value to the first element in the list for the specified field. Note: This does not automatically cause the databroker to notify its listeners. To do this use the databroker's notify() method. |
GeoSpacial | |
distance
(
|
Calculates the disance in between point(latitude1,longitude1) and point(latitude2,longitude2) |
Other | |
|
Calls the plugin method `` in [``](./Package) and returns the dynamic result. |
An eval
returning a color string based on a variables value.
<VAR id="isred" value="true"/>
<TEXT color="={isred}?red:green" label="Am I Red?"/>
An eval()
setting a TABLEROW widgets color to alternating based on the modulus of the index.
<TABLEROW id="datarow" color="=mod({datarow.index}, 2)==0?#0AFF0000:#0A0000FF"/>
Round and return the value 123.40.
<TEXT value="=round(123.4, 2, true))" />
An eval
setting the texts color to green using contains()
if the input variable contains 'He'.
<FML>
<VAR id="inputvalue" value="Hello"/>
<TEXT color="=contains({inputvalue}, He)?green:red" label="Succeeded?"/>
</FML>
An eval
with a substring()
returning the word 'There'.
<FML>
<VAR id="inputvalue" value="HelloThereHi"/>
<TEXT color="black" label="=substring('{inputvalue}', 5, 10)"/>
</FML>