Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Xponent uses Expressions extensively within Business Logic and for Conditional branches in graphs. Each expression can be defined in one of two ways: Basic or Advanced. Both of these techniques generates a JavaScript expression which is evaluated for truthfulness. 

Basic Expressions

Basic expressions provide a drop down list of common expressions which are available to be used: 

Selecting Advanced from the dropdown shows a JavaScript expression window that allows any valid JavaScript Boolean expression to be entered. By default when switching from the Basic to the Advanced view the equivalent JavaScript will be shown. 


Basic ExpressionArgumentsEquivalent JavaScriptNote
Is TrueNoneVAL === true
Is FalseNoneVAL === false
Less Than or Equal ToConstant Value - numeric or stringVAL <= 12.3
Greater ThanConstant Value - numeric or stringVAL > 12.3
Greater Than or Equal ToConstant Value - numeric or stringVAL >= 12.3
EqualsConstant Value - numeric, string or boolean VAL == {...}
Not Equal ToConstant Value - numeric, string or boolean VAL != {...}
ContainsConstant StringVAL.indexOf('abc') > -1

This is case sensitive.


Starts WithConstant StringVAL.indexOf("abc") === 0This is case sensitive. See this Knowledge Base article on how to make it case insensitive.
Ends WithConstant StringVAL.lastIndexOf("abc") === VAL.length - "abc".lengthThis is case sensitive. See this Knowledge Base article on how to make it case insensitive.


Advanced Expressions

Advanced expressions are any valid boolean JavaScript (ECMAScript 5) expressions. The JavaScript variable 'VAL' is always available and is set to the value of the previous node when used as an expression on a conditional branch. 

If the Basic Expressions do not have the type of operator that you require then the advanced mode should allow you to program your own condition. Examples include: 

DescriptionConditionalJavaScript
Membership of a list. Test to see if the returned value is in a list of values.

['worda', 
 'wordb', 
 'wordc'].indexOf(VAL) >= 0
Check if a javascript object is empty or not


Object.keys(obj).length === 0 && obj.constructor === Object



Miscellany 

It is worth taking note that JavaScript has some interesting outcomes when comparing against null: 

  • null >= 0 → true
  • null <= 0 → true
  • null == 0 → false

  • +null == 0 → true


  • No labels