Css expression syntax
From Emergent
Back to Css main page.
This is a quick reference on C/C++ expression syntax that is useful for users writing Programs.
In brief, you can refer to other variables, perform mathematical and logical computations, call functions, access data on data tables, etc all within these expressions! The lookup var and lookup enum buttons are useful for looking up variable and DynEnum values, and even more flexible and powerful is the Ctrl-L key (lowercase l), which will use whatever you have typed prior to pressing it in the expression to then lookup relevant items. For String variables, it will show all the methods (functions) available for manipulating strings; for objects, it will show object members and methods, including going through paths, etc. It is very powerful and you can save a lot of time by learning how to use it.
Contents |
Member/Method Access
For variables that refer to an object like a DataTable, Network, etc, you can refer to members or methods by using the '.' (period) between the object variable name and the member or method:
myobject.membername // access member myobject.methodname() // call a method (member function) on that object
Pressing Ctrl-L after having typed the object name and the '.' will pull up a list of members and methods to choose from.
Relational Operators
These are all pretty obvious. It is critical to remember that == is NOT = (single =)!! A single = is assignment, whereas == is equality.
| Operator | C Code | Example |
|---|---|---|
| Equal | == | (i == 2) |
| Not equal | != | (i != 2) |
| Greater than | > | (i > 2) |
| Less than | < | (i < 2) |
| Greater than or equal | >= | (i >= 2) |
| Less than or equal | >= | (i <= 2) |
Logical Operators
| Operator | C Code | Example |
|---|---|---|
| AND | && | (i >= 2 && i <= 4) |
| OR | || | (i == 2 || i == 4) |
| NOT | ! | !(i == 2) // same as i != 2 |
DataTable access expressions
There is a special syntax for accessing columns and rows of a DataTable which can save a lot of time and effort:
mydatatable["colname"][rowno]
the column can also be specified instead by number instead of name. You can use negative numbers for row number (or col number) to access from the end: -1 = last row, -2 = 2nd to last, etc.
