Form |
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 parametersThe 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.
Rule to enable/disable form fieldsRules 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 variablesVariables 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 fieldThe 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:
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 formulaTo 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 formTo calculate, the user should use math functions: Sum, Multiplication, etc. See further details in the following images:
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 resultTo 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 nameTo 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 starterTo 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:
How to enable form fields according to process activityTo 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.
How to calculate total of grid columnIt 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.
How to disable all fields of fieldsetTo 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/imageTo 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 titleTo 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 dateTo calculate the age, it is necessary to use some functions of date button in the toolbar. The following image displays an example.
Calculation with Hour fieldIt 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 formIt 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.
|