Warning!
You’re now reading a legacy document. The features described below are only usable within the classic generation environment. Proceed to this article if you are working with next-gen.
Description
Expressions are properties that can handle a certain logic, these are formulas that use your application data to get you a specific result. Their value can change depending on how the expression is calculated. For example, expressions can be used when you need to calculate the total price for all products in a list or get the first and last names added automatically to show the full name of a user.
Considered as pieces of custom functionality, expressions can be used in several places in your application: in the data model or in actions. In this article, we will look at how to use them in your application's actions to get specific and complex results you will not be able to get from static data model properties.
Setting up for using expressions
In the following example, we will go through creating a simple text (single line) expression in the already existing data model.
Open the data model section and choose the needed model. In our example, it will be the “Webuser”. |
After the ‘Webuser’ model is open, you will see all of its properties in the list. The underlined ones - ‘First name’ and ‘Last name’ are those that we will use to combine in the new property that will be called ‘Full name’. |
Click on the |
Creating expression property via actions
The next thing we need to do is open the actions in the previous environment. |
Note: After clicking the |
Here you will see different actions generated via the page builder. The action we need is the ‘Create webuser action’. Click once to open it. |
First of all, let’s add the ‘Create webuser’ action. Click on |
Select the following options in the action event configuration window:
Property Value First name var:record.first_name Last name var:record.last_name
|
Click
In the next window we will go through configuring this action step:
|
At the bottom of the page click on ‘Add’ to create a new variable. |
Here we will choose a text expression and type in its name. In the text field, insert two variables: ‘First name’ and ‘Last name’, divided by ‘+ “ “ +’, so it will look as follows:
var:new_webuser.first_name + “ “ + var:new_webuser..last_name |
Come back to the assign section and add the newly created expression to the property’s value. |
Click on |
Now each time a new webuser is created, the update event will happen after it, combining the first and the last names of webusers into the full name.
Learn more about the expressions you can apply here.