Creating a Command Statement
Statement in logic editor is a basic unit of building action logic. Other than the control statements such as conditional statement etc. most statement in your logic are Command Statements. You type a command to accomplish a task such as clicking a button, connecting to db, verifying an element on screen etc.
To create a command statement,
- In a new statement, type what you want to accomplish. For example, "click", "type", "database" etc.
- accelQ presents a set of suggestions.
- Select the most appropriate suggestion and follow through the guided steps.
- Provide values for command arguments.
Creating command statement from View canvas
Alternatively, you can insert a command statement from view canvas in the action detail page. Hover on the required element on the view and right click for command options. Based on the type of element you are working with, appropriate default command is already highlighted in the list.
Once you select the command, new statement is inserted at the end of current logic. You can then drag/drop to required location.
List of commands presented on an element are limited to exclusive commands on the particular element type. If you need more generic or page level commands, insert statement from the logic editor.
Note: When hovering on an element in view canvas, make sure to select correct element to create a command for. It may be possible there are multiple elements in close proximity (in the DOM hierarchy). Here is some guidance.
Command Arguments
General structure of a statement looks as follows.
This statement enters text "john@accelq.com", in the User ID field of your application page. Links displayed in blue, green or orange color indicate arguments to the command. These arguments vary depending on the command. When you create a statement, you provide values for these arguments. Arguments can be provided with either hard-coded values or with parameters.
Enter "john@accelq.com" in "User ID" field. Here are the arguments for this statement:
- What value needs to be entered? john@accelq.com
- Which input field needs to be interacted with? User ID
Color convention for arguments
Following color convention is used to indicate the nature of different arguments in logic editor
- Green: Indicates a UI Element argument which is available in Element Repository and linked with a view in Context
- Orange: Indicates a UI element argument which is abstract. This element is listed in the repository, but not linked with any field in the Context's view.
- Blue: Indicates a non-UI-Element argument such as the text to enter in a field
Capturing return value from a statement
Some commands may return information related to the execution of the command. In these cases, you have an option to capture the return information into a place-holder variable. You typically use this variable in building subsequent logic. An example below.
When you are creating a statement with command that returns a value, you get an option to capture or ignore this value.
You can store the return value either in an Action Output Parameter or in a local parameter.
- Store the information in an Action Output if you need this information to be available outside the action call. Scenario, where this action is used can make use of this output parameter to supply information to subsequent steps.
- Store the information in local parameter, in case the utility for that information is strictly within the action itself. For example, you might want to reach the number of rows in an excel sheet and loop on the number of rows to perform some validation. In this case the row count in the excel sheet is used only for the purpose of looping.
A note on Local Variable or Local Parameter
Local variables allow storing and using information across multiple statements in action logic. Usage (or scope) of local variable is within the given Action.
For example, consider the following statement, which generates a random email address with a given prefix and domain name.
Here, "email address" is a local variable, which captures the random email in the first statement. Subsequently, you use the same parameter to enter in the email address text field. You do not need this information anywhere outside of this Action, so it is best to use a local variable. If this information was to be shared outside of this Action, you would use Action Output Parameter.
Remember following points about local variables:
- Created as part of internal Action logic.
- Useful to process information between multiple statements in the logic of a given Action
Comments
0 comments
Article is closed for comments.