Note: Expressions is an advanced concept which requires programming knowledge. 


Transform Studio's Expression Engine allows you to add business logic to mobile forms. With the help of expressions, you can access entities, carry out arithmetic operations, and much more.


With the help of this article, you will learn about some of the commonly used expressions we have used across mobile forms. 


For all the examples below, keep in mind the following:
  • identifier1 is a TextBox
  • identifier2 is a TextBox
  • identifier3 is a SegmentedControl

 

Binding Expressions

Controls["identifier3"].Value
Controls["identifier1"].Text


This expression is to be used in the Bindings tab when “Value” is selected in the attribute property. Using it shows or sets the value of controls like a Segmented control in other controls.


Arithmetic Expressions

You can use these expressions as examples to carry out basic arithmetic operations on the data in controls.


Addition

ToNumber(Controls["identifier1"].Text) + ToNumber(Controls["identifier2"].Text)


Subtraction 

ToNumber(Controls["identifier1"].Text) - ToNumber(Controls["identifier2"].Text)


Multiplication

ToNumber(Controls["identifier1"].Text) * ToNumber(Controls["identifier3"].SelectedValue)


Division

ToNumber(Controls["identifier1"].Text) / ToNumber(Controls["identifier3"].SelectedValue)


Percentage


In addition to the above, you can use the following expression to calculate the percentage of the contents of two TextBox controls, and show it in another control.

(ToNumber(Controls["identifier1"].Text))/(ToNumber(Controls["identifier2"].Text))*100


Visibility Expression 

You can use this expression to control the visibility of a control.

Controls["identifier3"].SelectedValue = "Other"


Email Field Expression

You can use this expression in To, BC and CC fields when emailing form data in PDF form.

ControlsData[identifier1].controlValue[0]


Concatenation Expression

You can use the following expression to concatenate two control values with spaces in between.

Controls["identifier1"].Text + " " + Controls["identifier2"].Text + " " + Controls["identifier3"].SelectedValue


Current Time Display Expression

This expression allows you to show the device’s current time in the Date Picker, Date/Time Picker, and Time Picker controls.

Now().TimeOfDay


Notifications Expressions

This expression allows you to display notifications to users with specific roles.

Login.Roles.Find(Name = "notificationusers") ! null


This expression allows you to display notifications to users with specific user IDs.

Login.UserID="notificationusers"


Multi-Option Display Expression

The following expression is used in the DataSource property of a Picker or Auto Complete control to display the contents of a column in an entity.

Entity["EntityName"].GroupBy(["ColumnName"])


Filter Picker Expression

The following expression is entered in the DataSource property of a Picker control. It is used to populate a Picker control based on the value selected in another Picker control. 

Entity["locations"].FindAll(["Site"] = Controls["Site"].SelectedValue).GroupBy(["Location"])


Text Length Expression

The following expression sets the text length in a TextBox Control.

Controls["identifier1"].Text.Substring(0, 50)



Need help? Contact us at support@makeen.io