Navigation:  Tools > Formula editor > Editing functions and formulas >

Form

Previous  Top  Next

A form is composed of fields and each field is related to an entity attribute. Entities are tables in the database and attributes are table columns. An example of a formula can be the verification of a field value and performing some actions in other fields. Such actions are: Enable, disable, check as required, not required, display, hide, clear, load and apply value to a field.

 

Where and when the rule is executed (formula)

Rules/formulas are executed in the form events. An event is a system control that monitors the use and triggers rule execution. An example of that engine is loading the form. After the form is loaded, the formula associated with that event is executed. Another example is the click on a checkbox item and execution of the formula associated with that click on the item. The most common events in the form items are: in, out, change and click.

 

 

Function parameters

The formula editor consists of: toolbar, editing area, and presentation area. The toolbar is composed of a library of functions available to the component where the formula editor was opened; The editing area allows the inclusion of the rules and; The presentation area displays the rules of the editing area in different colors, allowing you to more easily identify the functions that allow the function parameters to be included through a selection screen.

 

A

When you click on the arrow next to the function type, a menu will be displayed containing all the functions of that type.

B

By clicking on the function menu, it will be copied to the editing/presentation area; The function's parameters screen will automatically be displayed as soon as the function is copied to the formula editor.

C

When you click on the function, in the presentation area, the function parameters screen will be displayed, allowing to change the configurations performed. Upon configuring the parameter and saving it, the system will update the function in the edition and presentation areas.

 

Rule to enable/disable form fields

Rules that disable fields in a form are usual, according to some selected option. A simple example is a set of radio buttons to identify the marital status (Single/Married). In this example, when the user selects the "married" option, the "Name" field of the "Spouse" area should be enabled. For better understanding, the user can write the formula (rule) in a simple way that the formula editor needs:

 

 

Simple description of rule: When the user clicks in the "Married" field, the "Spouse name" field, of the "Spouse" area should be enabled. The user should also remove any markups performed in the other radio buttons of the "Marital Status" area.

 

"When", from the description above, is determined by the click event in the radio button "Married". The action to enable the "Spouse name" field and to uncheck the other radio buttons is determined by the "ACTION" function. Click on the function, in the presentation area, and on the parameters screen, select all the fields of the form that will be changed by clicking on the "Married" radio button. Use the columns of the parameters screen to enable the "Spouse name" field and clear the fields of the other radio buttons. See more details in the image as follows:

 

 

How to use variables

Variables are used to save values and used in several places in the formula. A common example is to search the value of a field and compare several times in the formula to enable/disable fields according to a value.

 

To create a variable, the user should type a letter or a word followed by "=" (equal) character and the value of the variable. The value can be a number (result of a calculation), a text (in that case between single quotation marks) or the value of a form field.

 

 

How to use conditions (if/else) to enable fields according to the value of another field

The conditions are used when the user wishes to verify the value of a field and depending on the value, enable some fields or disable/hide other. To enable/disable fields, the user should always use the ACTION function. The following image displays an example that searches the value of a field and stores it in a variable to be used in the conditions:

 

A

Searches the field value and stores it in the variable "v" (value).

B

If the value of "v" is equal to ' John ', that is, if the issuer's name is equal to ' John ', the action applied is to enable the 'starttime' field.

C

If the value of "v" is equal to 'Anne', that is, if the issuer's name is equal to 'Anne', it will be mandatory to fill in the 'starttime' field.

 

For each IF/ELSE command, END command is necessary. The ACTION function is attributed to x variable, because the formula system keeps the standard that the return should be treated in all functions. The user can also apply "RETURNS ACTION(...)". The FIELDVALUE function uses 2 parameters: Entity ID # and Entity attribute ID #. To facilitate opening the screen of system parameter configuration, the system fills out the field with current form entity.

 

How to search for selected value in the list (combobox/zoom)

To search the value in the list (combobox/zoom) the procedure is similar to searching the value in another field (input, etc.). The user should use LISTVALUE function in the FIELDVALUE. The LISTVALUE function allows searching selected value that is not displayed in the screen. See an example in the picture below:

 

 

The LISTVALUE function has 3 parameters: entity ID #, relationship ID # (the same used in the combobox/zoom properties in the form) and attribute ID #. When the user opens the configuration screen of the function parameters, the system fills out automatically the source entity of the current form. The user should select the relationship and the attribute that they wish to search.

 

How to fill out the value in the field via formula

To fill out the value in a field via formula, the user should use the same function that enables/disables fields. The user can enter in the last parameter, a variable that contains the value to be filled out. The following image displays an example.

 

 

How to calculate with values entered in form

To calculate, the user should use math functions: Sum, Multiplication, etc. See further details in the following images:

 

A

Sum operations.

B

Multiplication operations.

C

Subtraction and division operations.

D

For divisions with decimal numbers, the user should multiply the decimal value by 1 and then divide it.

 

SUM and MULTIPLICATION functions have parameters that are the operation values, separated by semicolon (;). If a decimal number should be divided, the value should be multiplied by 1 before the division. This is because the system needs to convert the ("," or ".") separator from decimal places to a single format.

 

How to fill out the value in the field with calculation result

To fill out the value in the field with the result of calculation, the user should use ACTION function to specify the value in the field. The following image displays an example that multiplies two fields and fills out the value with the result in total field.

 

 

How to fill out the value in the field with the logged user name

To do this, ACTION function will also be used. The logged user name can be obtained through LOGGEDUSER function. See more details in the image as follows:

 

 

How to fill out the value in the field with process starter

To do this, ACTION function will also be used. The name of process starter can be obtained through the STARTER function. See more details in the image as follows:

 

 

It is important to point out this function can only be tested through the execution of a process in SE Workflow.

 

How to enable form fields according to process activity

To enable fields according to the activity, first the user should search the ID # or name of the activity to use it in the conditions. To do that, the ACTIVITY function is used to search the current activity where the form is visualized. After that, the user should create the conditions (IF/ELSE) and use ACTION function to enable/disable fields. The following image displays an example.

 

 

One example is entering the ID # and the system searches Name, Age, etc.

That example is used in those cases when the user types the ID # or code and the system searches in the other entities, the name, age, marital status, etc. To do that, the user should follow the next procedure:

 

In out event of registration field, create a formula;

In the formula, the user should first search the registration field value (usrregistry) and store it in a variable (usr_registry). FIELDVALUE function is used

Create a filter with the registration value in the entity that has data such as name, age, etc. (entity 'E002 - Employee'). TABLEFILTER function is used.

Search name and age in entity (E002 - Employee) using the filter created before and store it in variables ('var_nm' and 'var_age'). FIELDVALUEFILTER function is used.

Complete the name and age in the form fields using ACTION function.

 

A

Searches registration (usrregistry) filled by user in form

B

Creates a filter in 'E002 - EMPLOYEE' entity by 'registryid' attribute

C

Searches name and age in 'E002' entity using the filter

D

Fills out name and age fields in the form with the variables value

 

How to calculate total of grid column

It is not necessary to display the column in the grid, because it is considered an entity column. TOTALGRID function should be used to calculate. The relationship and grid entity are entered in this function (the same data entered in the grid properties), the field user wishes to calculate and the operation (Sum, Average, Maximum, Minimum, Counter). After calculation, the user can enter the result in a form field via ACTION function.

 

A

Calculates the total sum of the grid column (TOTALVL).

B

Fills out a decimal field with the result.

 

How to disable all fields of fieldset

To apply actions to all items within a fieldset, the user can use GROUPACTION. They should enter the fieldset ID # and the actions to be performed. It is used in those cases when the user wishes to hide or disable several form sections. To apply more than one fieldset, the user should repeat the line and modify the ID # for each fieldset.

 

 

How to hide/display title/image

To hide or display fields of title or image type, the user should use the ACTIONITEMLAYOUT function. That function is similar to GROUPACTION. The user should enter the ID # of title or image item and the actions to be performed.

 

 

How to fill out value in the title

To fill out the value in the title, the user should use the ACTIONITEMLAYOUT function. They should enter the variable with the value to be filled out only in the last parameter. The following image displays an example.

 

 

Example to calculate the age from the birth date

To calculate the age, it is necessary to use some functions of date button in the toolbar. The following image displays an example.

 

A

Searches birth date that has been filled out in the form.

B

Searches today's date through TODAY() function.

C

Separates dates into year, month and day.

D

Calculates the age through the subtraction of current year and birth year.

E

Verifies if it has already been the user's birthday this year. If it hasn't been their birthday this year, the system will subtract one year.

F

Fills out the value of age field with calculated age.

 

Calculation with Hour field

It is possible to calculate the number of hours there are between the two time type fields. The following image shows an example between time field and current time.

 

 

How to use ACTION, GROUPACTION and ACTIONITEMLAYOUT functions in the same form

It is possible to use ACTION, GROUPACTION and ACTIONITEMLAYOUT combined functions. There are cases when the user wishes to keep only an item enabled within a fieldset and keep the other items disabled. In that case, the user can disable all the fieldset items with GROUPACTION function and then enable the desired field with ACTION function. The action sequence is respected. The following image displays an example.

 

 

A

Disables all the items within the fieldset.

B

Enables only total field.

 

It is important to point out it is not necessary to concatenate using ‘|’ (pipe). Returning an action is not necessary anymore, either.

E.g.: A = ACTION(...)

B = ACTION(...)

RETURNS A+’|’+B