, ,

Define Calculated Fields and Visibility/Enabled formulas

One of the options available with every control is to provide its value using a calculation formula. By setting a field to be calculated, you have to define the calculation formula for the field values.

You can also use calculation formulas in the “Visibility formula” and “Enabled formula” properties, on the General tab. These formulas should always return a Boolen (True/False) value to indicate whether a control should be visible/enabled or not.

The calculation formulas use Javascript like syntax and a guide on how to use them is available in Form Properties and Methods.

To reference the value of a control i.e. c_Control1 which contains text, simply use the following syntax:

Code

The above expression is the equivalent but shorter version of the following:

Code

For example, let’s assume we have 2 controls on our form

c_Control1 is a Textbox

c_Control2 is DateTimePicker

Our example form looks like the following:

 

We decide to use a calculation formula on the Textbox control (c_Control1), so that anytime a date is selected on c_Control2, c_Control1’s text will display:

Selected Date : followed by the selected date.

 

Note:

You can also have the same result by typing in the following expression:

Code

After saving the above changes, everytime a date is selected on the DateTimePicker control the Textbox control will show: