- 1. Overview
- 2. Process Functions
- 3. Task Functions
- 4. Dynaform and Field Functions
- 5. Case Functions
- 6. Case Routing Functions
- 7. Case Notes Functions
- 8. User Functions
- 9. Group Functions
- 10. Email Functions
- 11. Document Functions
- 12. Unique ID Functions
- 13. Date Functions
- 14. String Functions
- 15. Database Functions
- 16. Grid Functions
Dynaform and Field Functions
PMFDynaFormFields() retrieves all the properties of each field in a Dynaform. If the unique ID and delegation index of a case is specified, it will also retrieve the entered
value of each field and its
label. Note that the
label is the same as the
value for textboxes and textareas, but it is the displayed text of a selected option in a dropdown box, suggest box, radio button, checkbox and checkgroup.
- string dynaformUID: The unique ID of the Dynaform where the fields are located.
- string caseUID: Optional. The unique ID of a case. If specified, then the values and labels of that case will be inserted into the properties of the Dynaform fields. Make sure that the specified case and the specified Dynaform belong to the same process. The unique ID of a case can be found in the following ways:
- int delIndex: Optional. The delegation index of the case. If specified, then values and labels of that case will be inserted into the properties of the Dynaform fields. The delegation index starts counting at
1for the first task in the case,
2for the second task,
3for the third task, etc. It can be found in the following ways:
An associative array of information about each field contained in the Dynaform specified. The return value will depend on how many and what kind of fields are inside the Dynaform.
First, create a simple Dynaform with the same fields as the Dynaform in the image below:
Second, copy the number of the Dynaform:
Third, create the following trigger with the number of the Dynaform:
@@AFields = PMFDynaFormFields($dynaformUID, @@APPLICATION, @%INDEX);
@@Afields will obtain all the information about each field contained in the Dynaform. The return value can be seen using the Processmaker Debugger:
PMFGetDynaformUID() retrieves the unique ID of a Dynaform using the Dynaform name and, if required, the unique ID of the process.
- string dynaformName: The name of the Dynaform.
- string processId: Optional parameter. The unique ID of the process, which can be found in the following ways:
- string: The function returns the unique ID of the Dynaform.
- string field: Value to be stripped of thousands separators and currency symbols.
- string separator: Optional. The thousands separator, which by default is
","(comma). In most European and Latin American countries, the thousands separator is
- string currency: Optional. The currency symbol. This parameter is set to an empty string by default, so if the parameter is not set no currency symbol will be removed.
- string processUID: The unique ID of the process that contains the field. To use the current process, use the system variable
- string dynaformUID: The unique ID of the Dynaform where the field is located.
- string fieldName: The field name of the dropdown box, checkbox group or radiogroup from the specified Dynaform.
- string optionUID: The value (i.e., ID) of the option from the
- "6962405664a55ed3b36b168077366134": is the UID of the Dynaform that holds the dropdown box.
- "countries": is the name of the field whose values are displayed as options in the dropdown box.
- "@@countries": is a variable that holds the ID of the option that has been selected in the dropdown box.
The returned value stored in
@@dynUID will be
PMFRemoveMask() function removes the mask of a currency field by deleting the thousands separator (which is a "." (period) or "," (comma) and the currency symbol, such as "$", "€", "£" or "¥". Call this function before using a currency field in a mathematical calculation that requires a number rather than a string.
A string with the the currency and thousands separator removed.
Note: PMFRemoveMask() returns a string. In most cases this is not a problem, because PHP will automatically convert the string into a number if it is used with a mathematical operator (+, -, *, /, %, etc.) or compared (==, !=, >, >=, < or <=) with a number. Nonetheless, it may be a good idea to convert the string into a real number using floatval(), or into an integer using the intval() function to avoid potential problems.
Example in a trigger:
PMFRemoveMask() function to delete the mask of a value introduced in a currency field named "Amount". Then use the is_numeric() function to check whether it can be converted into a number. If so, then convert it to a real number and then subtract 10% from the amount for a discount. If not a valid number, then use the
G:SendMessageText() function to display a warning message to the user on the next screen:
For instance, if the value of
"$5,000.00", then it will be converted into
floatval() will convert it into
5000.00 (a real number). Notice that the comma (,) and the dollar sign ($) were removed from the string.
Note: Case variables that are passed as the first parameter of
PMFRemoveMask() should be referenced as
@=field-name, so that they are maintained as text. Do NOT use
@%field-name, since PHP will try to convert the value to a number, which probably will not work correctly, depending on the mask.
Example in a condition:
Depending on the value introduced in a field, the following condition is used to decide whether the workflow moves to subsequent task(s):
This condition can be used inside an evaluation routing rule:
PMFgetLabelOption() returns the label of a specified option from a dropdown box, listbox, checkgroup or radiogroup.
Warning: Note that this function cannot be used with fields that have a dependent SQL query set.
A string holding the label of the specified option or NULL if the specified option does not exist.
To find the label from the selected option in a dropdown box, it is not necessary to use PMFgetLabelOption().
Dropdown boxes have a new attribute called "saveLabel". When set to "1", it permits the value of a label for a selected option to be saved automatically in a variable with the same name as the original variable, but with "_label" added to the end of the variable name. For instance, if trying to find the label of the selected option in the "countries" dropdown box, it can be found in the "@@countries_label" variable.