View Article

Add an Expression

By Xelence Documentation posted 05-27-2021 12:28

  

Introduction

Expressions are conditions that determine how forms and other parts of the application behave. They can set visibility, enable controls, validate constraints, etc.

Prerequisites

The attributes, logical rule, scalar query and a condition you are using must already exist.

Quick Steps
1 Open the entity, then open the Conditions section.
2 Open the Expression section in the Default group, then add a new expression
3 Enter the details, then click OK
4 Add a new group,
5 Enter the expression details
6 Configure the other expression properties
7 Save the Entity

Detailed Steps

Step 1. Open the entity, then open the Conditions section.

 In this example, it is the entOrder.



Step 2. Open the Expression section in the Default group, then add a new expression.

This is where the entity manages its expressions. Click the + icon to add an expression.



Step 3. Enter the details, then click OK.

The important properties are:

  • Select/Add Group Name: Specifies the group to which the expression belongs. Every expression must belong to a group. If no appropriate group for your expression exists, you have to create one by entering its name. In this example, the Default group is selected.
  • Name(ID): A descriptive name given to your expression.
  • Access Modifier: Specifies the level of accessibility of the expression. The options are:
    • Public: Any entity can access this expression.
    • Private: Only this entity can access this expression.
    • Protected: This entity and any child entity can access this expression.
  • Description: Optionally, you can enter a short description for your expression.
You can cut, copy or paste a condition from one group to another, if needed.
Enter the desired group name and name of the expression. Click OK.



Step 4. Add a new group.

If your expression has a combination of conditions, you can nest these with groups. Select the condition and click the Add Group button to add the group at selected level.

If your expression has a single condition, you can select the condition and click the Add Condition button to add a new condition.



Step 5. Enter the expression details.

The first field identifies what the expression is comparing. Options are:

  • Query: Allows you to use queries in your expression.
  • Attribute: Allows you to enter the entity attribute.
  • Rule: Allows you to use rules in your expression.
  • Condition: Allows you to insert another condition in your expression as long as it’s part of the same entity.
The next field is the specific item, such as the name of the attribute.
The third field is the operation the application will use for the comparison.
The fourth field identifies what the expression is comparing to. All other options are same as the first field except the following:
  • Constant: Fixed value to compare to.

The last field is the specific comparison item such as the name of the attribute or any constant value.

This example uses the ANY operator at the top, so this expression will be true if either:

  • The shipped date is less than or equal to the Order Date.

           OR

  • The Shipped date is greater than or equal to the Required Date.



Step 6. Configure the other expression properties.

The important property is:

  • Message ID: Allows you to link a message to the expression condition. If you don’t enter a Message ID, the application displays the default message. Click the + icon if you want to create a new message if the message doesn't already exist.

Select the expression to open its properties. This expression uses a message from the message table; this will display in the system whenever the expression evaluates to true, so the user knows what's wrong. Alternatively, you can enter the message description. You can select any other applicable properties as well.



Step 7. Save the Entity.

Now that the expression exists, you can use it elsewhere in the application. For example, you could add it to a constraint section of the entity. This example uses the expression in Server Constraints. Whenever the application evaluates this expression to true, it will not persist the data. It will display an error message on the form, so the user knows how to correct the data.

Click the icon to save your entity file.
Similarly, you can add a Query based expression using an existing scalar query. In this example, this expression can be added as a condition in delete constraint to restrict the orders with verified products from getting deleted.


You can also add a Rule based expression using an existing logical rule. In this example, this expression can be added as a condition in server constraint to display a message when the invoice amount exceeds 10000.


Likewise, you can also add a condition based expression using an existing expression. In this example, the expression can be added as a visible condition for EmailId field which is visible only if this expression evaluates to True.



What are the improvements over S3 Version 6?

The process is enhanced. Previously, single attribute expression could be added. Now, you can add multiple attributes and complex conditions to it.


Related Articles

Add a Field Constraint

Configure a Validate Delete Constraint

Make a Control Visible Based on a Condition

Make a Control Read-Only Based on a Condition

Configure a Server Constraint

Configure a Soft Error


This post is part of the Entity topic. Click here to open the Entity Overview.


#Xelence
#Entity

0 comments
201 views