Difference between revisions of "OtfExpressionEditor"

From emotive
Jump to navigation Jump to search
 
Line 1: Line 1:
 
{{DISPLAYTITLE:Open Test Framework - Expression Editor}}[[Category:OTF]]
 
{{DISPLAYTITLE:Open Test Framework - Expression Editor}}[[Category:OTF]]
  
With the '''Expression Editor''', a simple or a complex expression can be created without writing code, see the [[#ExprEditorImg|image below]]. In OTX, an expression refers to an OTX term (or function). An OTX term may consist of different operators and terms (i.e. operators and terms can be nested), and it has exactly one return value of a defined data type. All the OTX terms are categorized in the editor according to the OTX libraries (OTX Core and other OTX extensions, the OTX Core will be divided into small categories). To open the Expression Editor, you can select the "'''<Expression>...'''" menu item in the combo-box of a property in the [[OtfPropertiesWindow|properties window]].
+
With the '''Expression Editor''', a simple or a complex OTX term can be created without writing OTX code, see the [[#ExprEditorImg|image below]]. An OTX term may consist of many terms and different operators (i.e. operators and terms can be nested), and it has exactly one return value of a defined data type. All the OTX terms are categorized in the editor according to the OTX libraries (OTX Core and other OTX extensions). To open the Expression Editor, you can select the "'''<Expression>...'''" menu item in the combo box of a property in the [[OtfPropertiesWindow|properties window]]. With the Assignment activity, you can easily access the Expression Editor by clicking on the wrench icon ("[[File:Wrench.png|Wrench.png]]") on the Assignment in the workflow.
  
==The features of the Expression Editor==
+
== Expression Editor Features==
The Expression Editor consists of the expression editor in the upper part and the selection box in the lower part, see image.
+
The Expression Editor consists of the expression box in the upper part and the selection box in the lower part, see image.
  
 
{{Anchor|ExprEditorImg|}}
 
{{Anchor|ExprEditorImg|}}
{{ImageStyleCenter|ExpressionEditor.png||Expression Editor allows for creating and editing OTX terms}}
+
{{ImageStyleCenter|ExpressionEditor.png|1100|Expression Editor allows for creating and editing OTX terms}}
  
===Expression Editor===
+
=== Expression Box ===
In the expression editor, the expressions can be freely created and edited using the keyboard.
+
In the expression box, the OTX terms can be freely created and edited using the keyboard.
  
===Supported operators===
+
=== Supported Operators ===
The operators can be entered in the expression editor by using the keyboard. For example the "'''+'''" operator:
+
The operators can be entered in the expression box by using the keyboard. For example the "'''+'''" operator:
  
''<big>StringLength(Variable1) + 5</big>''
+
''<big>LengthOfString(Variable1) + 5</big>''
  
 
The Expression Editor supports the selection of the following important operators:
 
The Expression Editor supports the selection of the following important operators:
Line 56: Line 56:
 
|}
 
|}
  
===Selection box===
+
=== Selection Box ===
In the selection box below the supported operators, all the usable terms (functions) and variables are listed in groups. To insert a term or a variable at the current cursor position in the Expression Editor, you only need to double-click on that term or variable in the selection box.
+
In the selection box below the supported operators, all the available declarations, parameters, validities and OTX terms (also user-defined terms) are listed in groups. To insert a term or a declaration at the current cursor position in the Expression Editor, you only need to double-click on that term or declaration in the selection box.
  
===Terms (Functions)===
+
=== Terms ===
  
A function has the following basic structure:
+
A term has the following basic structure:
  
 
''<big>«result» = Name(«arg1», «arg2», «...», «argN»)</big>''
 
''<big>«result» = Name(«arg1», «arg2», «...», «argN»)</big>''
  
At the time of execution, each function returns a '''«result»'''. Each function contains arguments '''«arg»''', and each argument can be replaced with a literal value (or a literal expression), a declaration or another function, note that the data of the input declarations shall not be changed by the calculation. See [[Core.Terms|here]] for a list of all functions.
+
At the time of execution, each term returns a '''«result»'''. Each term contains arguments '''«arg»''', and each argument can be replaced with a literal value (or a literal expression), a declaration or another term, note that the data of the input declarations shall not be changed by the calculation.
  
==Adding an expression==
+
== Adding an Expression ==
To add an expression to a property of an activity, please proceed as follows:
+
To add an expression of OTX term to a property of an activity, please proceed as follows:
  
 
# Open the [[OtfPropertiesWindow|properties window]] to view the properties of the activity
 
# Open the [[OtfPropertiesWindow|properties window]] to view the properties of the activity
# Select the "'''<Expression>...'''" menu item in the combo-box of the property you want to add the expression
+
# Select the "'''<Expression>...'''" menu item in the combo box of the property you want to add the expression
# Find the appropriate function in the selection box
+
# Find the appropriate term in the selection box
# Double-clicking on the function to insert it at the current cursor point in the Expression Editor
+
# Double-clicking on the term to insert it at the current cursor point in the Expression Editor
# Click on one of the arguments of the function
+
# Click on one of the arguments of the term
# Find and double-click on a variable or a function for nested function to input value for the argument
+
# Find and double-click on a declaration or a term to input for the argument
# Do the same for all the other arguments, you can delete the unrequired arguments
+
# Do the same for all the other arguments, you can delete the optional arguments
 
# Add operators by manually typing on the keyboard (if necessary)
 
# Add operators by manually typing on the keyboard (if necessary)
# Add more functions and variables etc.
+
# Add more terms and declarations etc.
 
# Apply the expression to the property via the OK button.
 
# Apply the expression to the property via the OK button.

Latest revision as of 09:56, 19 October 2018


With the Expression Editor, a simple or a complex OTX term can be created without writing OTX code, see the image below. An OTX term may consist of many terms and different operators (i.e. operators and terms can be nested), and it has exactly one return value of a defined data type. All the OTX terms are categorized in the editor according to the OTX libraries (OTX Core and other OTX extensions). To open the Expression Editor, you can select the "<Expression>..." menu item in the combo box of a property in the properties window. With the Assignment activity, you can easily access the Expression Editor by clicking on the wrench icon ("Wrench.png") on the Assignment in the workflow.

Expression Editor Features

The Expression Editor consists of the expression box in the upper part and the selection box in the lower part, see image.

ExpressionEditor.png
Expression Editor allows for creating and editing OTX terms

Expression Box

In the expression box, the OTX terms can be freely created and edited using the keyboard.

Supported Operators

The operators can be entered in the expression box by using the keyboard. For example the "+" operator:

LengthOfString(Variable1) + 5

The Expression Editor supports the selection of the following important operators:

Operator Description
+ Additions
- Subtraction
* Multiplication
/ Division
% Modulo, calculates the remainder after dividing its first operand by its second
& Bitwise AND combination
| Bitwise OR combination
^ Bitwise XOR combination
&& Logic AND
|| Logic OR
== Equal
!= Unequal
>= Greater than or equal
<= Less than or equal
> Greater than
< Less than

Selection Box

In the selection box below the supported operators, all the available declarations, parameters, validities and OTX terms (also user-defined terms) are listed in groups. To insert a term or a declaration at the current cursor position in the Expression Editor, you only need to double-click on that term or declaration in the selection box.

Terms

A term has the following basic structure:

«result» = Name(«arg1», «arg2», «...», «argN»)

At the time of execution, each term returns a «result». Each term contains arguments «arg», and each argument can be replaced with a literal value (or a literal expression), a declaration or another term, note that the data of the input declarations shall not be changed by the calculation.

Adding an Expression

To add an expression of OTX term to a property of an activity, please proceed as follows:

  1. Open the properties window to view the properties of the activity
  2. Select the "<Expression>..." menu item in the combo box of the property you want to add the expression
  3. Find the appropriate term in the selection box
  4. Double-clicking on the term to insert it at the current cursor point in the Expression Editor
  5. Click on one of the arguments of the term
  6. Find and double-click on a declaration or a term to input for the argument
  7. Do the same for all the other arguments, you can delete the optional arguments
  8. Add operators by manually typing on the keyboard (if necessary)
  9. Add more terms and declarations etc.
  10. Apply the expression to the property via the OK button.