Navigation:  System Specifications >

Expressions

Print this Topic Previous pageReturn to chapter overviewNext page

 

An expression might almost be considered a compound value.  All of the parts of the expression are resolved (each math operator or function is executed) into a single value.  Internally each expression is broken down into a series of expressions each involving only two elements.  For example:

 

1+2+3

 

In the above case the program calculates 1+2 first and then the result (or 3) +3 to get the answer 6.  However, in the case of:

 

1+2*3

 

The program calculates 2*3 first (since multiplication has a higher precedence than addition) and then adds that to 1 for a total of 7.  If you have any doubts as to the order of calculation you should surround values that you want to be evaluated in a certain order with parentheses.  In the above example, if you wanted 1 to be added to 2 first, and then multiplied by 3 your expression would look like:

 

(1+2)*3

 

The result would then be 9, or 1+2 to get 3 and then 3*3 to get 9.

 

The different elements (field or value) of the expression need not be of the same type.  The program will automatically convert the second part of the expression to the same type as the first.  For example:

 

"Today's date is: "+date()

 

The result of the expression above would be the current date (derived from the date() function) converted to an alpha field since the first part of the expression is an alpha field and the date value was automatically converted.  Again, if you have any doubts over whether or not a value is being converted properly you can also use the full range of conversion functions provided in TAS Professional.

 

An expression might be very simple.  For example:

 

1+1

 

Or it might get very complex:

 

size_hldr + iif(dict_array_ele <> 0,dict_array_ele*int_size,int_size)

 

Expressions may resolve to a value or may be a logical expression and use comparison operators also.  These type of expressions resolve to .TRUE. or .FALSE.  For example:

 

1 = 1

 

This resolves to .TRUE.  Another example might be:

 

x = 100 .OR. (y = 50! .AND. z = 'ABC')

 

And they might be made up of both:

 

x = (size*num_array_ele) .OR. field_name=('TEST'+date())

 

The only limit to the length of an expression is the maximum character limit per line.  Any legal function, including user defined functions (UDF), may be a part of an expression.

 

 

 

 


Page url: http://www.cassoftware.com/tas/manual/expressions.htm