Skip to end of metadata
Go to start of metadata

The scripts providing the forms will be dynamically loaded in PWE: Script injection

The component would build the form using a function, e.g.: buildForm( form, options ), where the form parameter would be the parameter container, and the options parameter would contain additional information, such as:

  1. destination - available only for the form action, it informs what form component the action is added to, available values are:
    1. FORM - form
    2. VARIABLE - variable
    3. VARIABLESET - dynamic table
    4. BUTTON - button
    5. DT_BUTTON - dynamic table button
  2. acceptButton - takes the value true if the action is added to the accept button
  3. tableId - identifier of the dynamic table (holds a value when destination takes the value VARIABLESET or DT_BUTTON)
  4. buttonId - identifier of the button when the action is added to the button (holds a value when destination takes the value BUTTON)

 

The component depending on the type should be registered using the method:

  • for form action - PWE.integrationComponent.registerFormAction( id_component, registration )
  • for validator - PWE.integrationComponent.registerValidator( id_component, registration )
  • for a class that sets variables - PWE.integrationComponent.registerVariablesSetter( id_component, registration )
  • for system application - PWE.integrationComponent.registerApplication( id_component, registration )
  • for data chooser - PWE.integrationComponent.registerDataChooser( id_component, registration )

 

Object registration contains following properties:

  • apiVersion - API version
  • labelWidth - parameters form label width, it has to be a number e.g. 150
  • buildForm - function that builds parameters form
  • validateForm - function that validates parameters form save

 

You can also register dynamic forms for system functions using the method:

PWE.integrationComponent.registerSystemFunction( function_name, function_parameters, registration )

The function parameters are an array of objects with the following properties:

  • type: type of parameter
  • id: identifier of the parameter
  • array: information if the parameter is an array (default: false)

It is possible to specify null as the parameter parametry_funkcji which will cause the dynamic form to be registered for all functions with the name specified in the parameter name_function.

The registration object has the following properties:

  1. buildForm - a function that builds a form of parameters
  2. toText - a function that returns a more readable representation, it takes parameters:
    1. parameterValues - of the Object form (that is, like a map in Java), we can receive individual parameter values by their identifiers, the received parameter value can be a table, or a direct text value, numeric value, etc.
    2. parameterTypes - of the Object form (that is, like a map in Java), we can receive individual parameter types by their identifiers, each entry in the map is an object that has the following properties:
      1. type - he name of the parameter type, e.g. string, integer, date, etc.
      2. array - true or false, indicates whether the parameter is of array type
  3. apiVersion - the version of the API of the form, the parameter is optional, if it is not specified, the API of the form version V1 is used

 

Registration of the function can look as follows:

PWE.integrationComponent.registerSystemFunction( 'concat', [ {
						type: 'string',
						id: 'strings',
						array: true
					} ], {
						apiVersion: 2,
						buildForm: function( api, options ) {
							api.addField( {
								id: 'strings'
							} );
						},
						toText: function( parameters ) {
							var strings = parameters['strings'];
							return 'konkatenacja( ' + strings.join( ', ' ) + ' )';
						}
					} );

 

Assumptions

  1. Ability to deploy parameters in a fairly customized way.
  2. Ability to plug events into parameter fields:
    1. change
    2. blur
  3. Grouping of parameters (I think only array parameters) - having, for example, 2 array parameters that are related to each other (e.g., setting variables - one parameter with variables and the other with values to be set) there was an option to present them as a pair for which there would be only one button to add another element of the array and this button would simultaneously add fields for all grouped parameters
  4. Hiding / showing parameters.
  5. The ability to define a selector with values for a parameter with the specification of whether you can enter your own value or select a function or variable.

  6. The ability to filter values, e.g.: for a parameter of type VARIABLE, we could filter what variables would be displayed. E.g., when we would like only variables of type FLOAT.
  7. Ability to add a simple label, I guess it will be useful for grouping parameters.
  8. Ability to add a checkbox - would allow to show and hide parameters.
  9. Ability to define a section that could be collapsed, such a collapsible fieldset.

The form definition might look as follows:

buildForm: function( form ) {
	//adding a parameter in basic form
	form.addField("parameter_id"); //parameter_id is the id of the parameter defined in the component
	
	//adding a parameter with the change event
	form.addField({
		id: "param_id",
		onChange: function(value, options) {
			if(value) {
				form.showField("hiddenParam");	
			}
			else {
				form.hideField("hiddenParam");
			}
		}
	});
 
	//adding a parameter that is hidden during initialization
	form.addField({
		id: "hiddenParam",
		hidden: true //domyślnie false
	});
}

FORM API V1 (apiVersion=1)

  1. addField(Object / parameterId) - adds a parameter field at the last position
  2. insertField(position, Object / parameterId) - adds a parameter field at the specified position (use the getFieldPosition function to determine the position for the field)
  3. removeField(parameterId) - removes the parameter field
  4. hideField (parameterId) - hides the parameter field
  5. showField(parameterId) - shows the parameter
  6. focusField(parameterId) - sets the cursor in the parameter field
  7. addLabel("Label text") - adds a label at the last position
  8. insertLabel(position, "Label text" ) - adds a label at the specified position (use the getFieldPosition function to determine the position for a field)
  9. addCheckbox(Object) - adds a checkbox at the last position, the definition object contains the following properties:
    1. name - the name of the field
    2. description - description of the field
  10. insertCheckbox(position, Object) - adds a label at the specified position (use the getFieldPosition function to determine the position for the field)
  11. addCombobox(Object) - adds a checkbox at the last position, the definition object contains the following properties:
    1. id - identifier of a parameter of String type, which will be in the form of a drop-down list, if the id is not given, the parameter does not exist or the variable is of other type than String, an independent drop-down list is added to the parameter form
    2. text - the label of the field
    3. value - the initial value
    4. remote - indicates whether the data of the drop-down list is to be retrieved from the server, or whether it is a static list (default: false), when remote has the value true, the following parameters are passed to the server during data retrieval:
      1. sort - name of the field by which the data are sorted
      2. dir - direction of sorting (ASC/DESC)
      3. query - currently entered value in the drop-down list, used to filter values
      4. start - offset
      5. limit - page size
      The server must return a json object with fields:
      1. total - the total number of results
      2. data - downloaded data including paging
    5. values - a list of values for the static drop-down list, the property is an array of objects, each of which has the following properties
      1. id - identifier of the value
      2. display - name of the value
      3. description - description of the value
    6. url - url that returns data from the server for the dynamic dropdown list, it can also be in the form of a function that returns a value of String type, which takes the following parameters:
      1. options - additional parameters passed to the function
        1. rowIndex - if the parameter field is of table type, then rowIndex is the position of the current parameter field in the table, the first position has a value of 0
    7. fields - the fields that are returned from the server, the property is an array of objects, each of which has the following properties:
      1. name - the name of the field
      2. type - field type (string, boolean, integer, float, date)
    8. valueField - the name of the field whose value is to be set as a parameter value
    9. displayField - the name of the field whose value is displayed in the list
    10. pageSize - the size of the page (default: 20)
    11. template - a template describing how to display values in the list, the property is an array of objects, each of which has the following properties:
      1. label - label for a field
      2. field - name of the field
    12. sort - allows you to specify the sorting of data from the server, the property is an object that has the following properties:
      1. field - the name of the field followed by sorting
      2. direction - sorting direction (ASC/DESC)
    13. onChange - a function executed after selecting a value from the list, it takes the following parameters:
      1. value - the value of the parameter field
      2. options - additional parameters passed to the function
        1. rowIndex - if the parameter field is of tabular type, then rowIndex is the position of the current parameter field in the table, the first position is 0
  12. insertCombobox(position, Object) - add a drop-down list on the specified position (to determine the position for the field, use the getFieldPosition function), the definition object contains the following properties:
    1. id - identifier of a parameter of String type, which will be in the form of a drop-down list, if the id is not specified, the parameter does not exist or the variable is of other type than String, an independent drop-down list is added to the parameter form
    2. remote - indicates whether the data of the drop-down list is to be retrieved from the server, whether it is a static list (default: false), when remote has a value of true, then the following parameters are passed to the server during data retrieval:
      1. sort - the name of the field by which the data is sorted
      2. dir - sorting direction (ASC/DESC)
      3. query - currently entered value in drop-down list, used to filter values
      4. start - offset
      5. limit - page size
      The server must return a json object with fields:
      1. total - the total number of results
      2. data - downloaded data including paging
    3. values - a list of values for the static drop-down list, the property is an array of objects, each of which has the following properties
      1. id - the identifier of the value
      2. display - the name of the value
      3. description - description of the value
    4. url - url that returns data from the server for the dynamic dropdown list, it can also be in the form of a function that returns a value of String type, which takes the following parameters:
      1. options - dditional parameters passed to the function
        1. rowIndex - if the parameter field is of table type, then rowIndex is the position of the current parameter field in the table, the first position has a value of 0
    5. fields - the fields that are returned from the server, the property is an array of objects, each of which has the following properties:
      1. name - the name of the field
      2. type - the type of the field (string, boolean, integer, float, date)
    6. valueField - the name of the field which value is to be set as a parameter value
    7. displayField - the name of the field which value is to be displayed in the list
    8. pageSize - the size of the page (default: 20)
    9. template - a template describing how the values are displayed in the list, the property is an array of objects, each of which has the following properties:
      1. label - a label for the field
      2. field - the name of the field
    10. sort - allows to specify sorting of data from the server, the property is an object that has the following properties:
      1. field - name of the field followed by sorting
      2. direction - sorting direction (ASC/DESC)
    11. onChange - a function executed after selecting a value from the list, it takes the following parameters:
      1. value - the value of the parameter field
      2. options - additional parameters passed to the function
        1. rowIndex - if the parameter field is of tabular type, then rowIndex is the position of the current parameter field in the table, the first position is 0
  13. getFieldPosition(parameterId) - returns the position of the parameter field, if the parameter is in a table, the position of the table parameter field is returned
  14. getFieldValue(parameterId, asString) -  returns the value of the parameter field, the value can be returned as a string (asString=true)
  15. setFieldValue(parameterId, value) - sets the value of the parameter field
  16. addButton(Object) - adds a button on the last position, the definition object contains the following properties:
    1. text - the text of the button
    2. iconCls - system css class for button icon
    3. tooltip  - button tooltip
    4. handler - function executed after clicking the button
    5. scope - scope for the function executed after clicking the button, default: window
  17. insertButton(position, Object) - adds a button at the specified position (use the getFieldPosition function to determine the position for a field), the definition object contains the following properties:
    1. text - the text of the button
    2. iconCls - system css class for button icon
    3. tooltip  - button tooltip
    4. handler - function executed after clicking the button
    5. scope - scope for the function executed after clicking the button, default: window
  18. addFieldToArray(parameterId) - adds a new field on the last position in the tabular parameter, the field is not added to the tabular parameter that is in the table
  19. removeFieldFromArray(parameterId, position) - removes the field at the given position from the tabular parameter, the field is not removed from the tabular parameter, which is in the table
  20. setFieldValueInArray(parameterId, position, value) - sets the value of the field at the given position in the tabular parameter
  21. getArraySize(parameterId) - returns the number of fields in the table parameter, or 0 if the field is not a table parameter
  22. resetArray(parameterId) - removes the row fields (except the first one) from the tabular parameter and clears the value of the first field, the fields are not removed from the tabular parameter, which is in the table
  23. addTable([ Object / parameterId ], Object) - adds a table (set of tabular fields) on the last position, the table definition object (second parameter) contains the following properties:
    1. tableId - identifier of the table to hide/show/remove the field
    2. name - the name of the table
    3. description - description of the table
    4. hidden - specifies whether the table is to be hidden
  24. insertTable(position, [ Object / parameterId ], Object) - adds a table (a collection of table fields) in the specified position (to specify the position for the field, use the getFieldPosition function), the table definition object (the second parameter) contains the following properties:
    1. tableId - identifier of the table, which allows you to hide/show/remove the field
    2. name - the name of the table
    3. description - description of the table
    4. hidden - specifies whether the table is to be hidden
  25. addDataChooserMapping(Object) - adds data chooser mapping, is relevant only for the data chooser component, the mapping object contains the following properties:
    1. id - mapping id
    2. description - mapping description
    3. variableId - id of the process variable to which the selected value in the data chooser is mapped
    4. name - text displayed for mapping during the presentation of data chooser results on the task form
    5. hidden - informs whether the mapping is to be hidden on the task form
    6. verify - informs whether the mapping is to be validated on the task form
    7. readOnly - informs which values cannot be edited in a given mapping, accepted values are:
      1. true/false - boolean variable, informs that none of the mapping values can be edited
      2. string - a variable of the string type, informs which of the mapping values cannot be edited (accepted values are: id, description, variableId, name, hidden, verify)
      3. array - tabular variable, informs which mapping values cannot be edited (accepted values are: id, description, variableId, name, hidden, verify)
  26. resetDataChooserMappings() - removes all data choose mappings, only relevant for the data chooser component

PARAMETER FIELD PROPERTIES (FIELD)

  • id,
  • onChange,
  • onBlur,
  • hidden,
  • optional,
  • notEmpty,
  • value,
  • readOnly
  • hideLabel
  • values - list of drop-down list value objects, each object contains properties id (value identifier), display (value displayed on the list), description (value description on the list)
  • url - url returning data from the server for a dynamic dropdown list, can also be in the form of a function

FORM API V2 (apiVersion=2)

  1. addField(Object / parameterId, position) - adds the parameter field at the specified position (use the getFieldPosition function to determine the position for the field), the position parameter is optional, if not specified, the object is added at the last position
  2. removeField(parameterId) - removes the parameter field
  3. hide (parameterId) - hides the parameter
  4. show(parameterId) - shows the parameter
  5. focusField(parameterId) - places the cursor in the parameter field
  6. addLabel("Label text", position) - adds the label at the specified position (to determine the position for the field, use the getFieldPosition function), the position parameter is optional, if not specified, the object is added at the last position
  7. addCheckbox(Object, position) - adds a checkbox at the specified position (in order to determine the position for the field you should use the getFieldPosition function), the position parameter is optional, if not specified, the object is added at the last position, the definition object contains the following properties:
    1. id - checkbox identifier of String type, it is possible to set checkbox value with identifier
    2. name - name of the field
    3. description - description of the field
    4. bindedFieldId - identifier of a parameter of logical type, its value reflects whether the checkbox is selected, changing the checkbox selection affects the value of the associated field
  8. addCombobox(Object, position) - adds a drop-down list at the specified position (to determine the position for the field, use the getFieldPosition function), the position parameter is optional, if not specified, the object is added at the last position, the definition object contains the following properties:
    1. id - the identifier of the parameter of type String, which will be in the form of a drop-down list, if the id is not given, the parameter does not exist or the variable is of type other than String, then an independent drop-down list is added to the parameter form
    2. name - the label of the field
    3. description - the description of the field
    4. value - initial value
    5. optional - indicates whether the value is required (default: false)
    6. forceSelection - informs that the parameter can only accept values in the list (default: true)
    7. remote - configuration for downloading data from the server, its absence informs that the list is a static list (default: null), contains such properties as:
      1. url - url that returns data from the server for the dynamic dropdown list, it can also be in the form of a function that takes the following parameters:
        1. options - additional parameters transferred to the function
          1. rowIndex - if the parameter field is of tabular type, then rowIndex is the position of the current parameter field in the array, the first position has a value of 0
      2. fields - the fields that are returned from the server, the property is an array of objects, each of which has the following properties:
        1. name - the name of the field
        2. type - the type of the field (string, boolean, integer, float, date)
      3. remoteSort - indicates whether the sorting is to be done on the server side or on the browser side (default: false - on the browser side)
      4. pageSize - the size of the page (default: 25)
      The server must return a json object with fields:
      1. total - the total number of results
      2. data - downloaded data including paging
    8. values - a list of values for the static drop-down list, the property is an array of objects, each of which has the following properties
      1. id - the identifier of the value
      2. display - the name of the value
      3. description - description of the value
    9. valueField - the name of the field whose value is to be set as a parameter value
    10. displayField - the name of the field whose value is displayed in the list
    11. template - a template describing how the value is displayed in the list, the property is an array of objects, each of which has the following properties:
      1. label - a label for the field
      2. field - the name of the field
    12. sort - allows to define the sorting of data from the server, the property is an array of objects, each having the following properties:
      1. property - the name of the field followed by sorting
      2. direction - sorting direction (ASC/DESC)
    13. listeners - object containing events, the following events are supported
      1. change - function executed after selecting a value from the list, accepts the following parameters:
        1. value - the value of the parameter field
        2. options - additional parameters passed to the function
          1. rowIndex - if the parameter field is of table type, rowIndex is the position of the current parameter field in the table, the first position has a value of 0
      2. blur - the function called when the field is exited, it accepts the following parameters:
        1. value - the value of the parameter field
        2. options - additional parameters passed to the function
          1. rowIndex - if the parameter field is of table type, rowIndex is the position of the current parameter field in the table, the first position has a value of 0
  9. getFieldPosition(parameterId) -  returns the position of the parameter field, if the parameter is in a table, the position of the table parameter field is returned
  10. getValue(parameterId, asString) - returns the value of the parameter field, the value can be returned as a string (asString=true)
  11. setValue(parameterId, value) - sets the value of the parameter field
  12. addButton(Object, position) - adds the button at the specified position (to determine the position for the field, use the getFieldPosition function), the position parameter is optional, if not specified, the object is added at the last position, the definition object contains the following properties:
    1. id - button id
    2. text - the text of the button
    3. iconCls - system css class for button icon
    4. tooltip  - buttontooltip
    5. handler - function executed after clicking the button
    6. scope - scope for the function executed after clicking the button, default: window
  13. hideButton(buttonId) - hides button
  14. showButton(buttonId) - shows button
  15. addFieldToArray(parameterId) - adds a new field on the last position in the table parameter, the field is not added to the table parameter that is in the table
  16. removeFieldFromArray(parameterId, position) - removes the field at the given position from the tabular parameter, the field is not removed from the tabular parameter that is in the table
  17. setFieldValueInArray(parameterId, position, value) - sets the value of the field at the given position in the tabular parameter
  18. getArraySize(parameterId) -  returns the number of fields in the table parameter or 0 if the field is not a table parameter
  19. resetArray(parameterId) - removes the row fields (except the first one) from the tabular parameter and clears the value of the first field, the fields are not removed from the tabular parameter, which is in the table
  20. removeLastArrayFields(parameterId, amount) - removes the specified number of row fields from the tabular parameter and clears the value of the first field, the fields are not removed from the tabular parameter, which is in the table
  21. addDataChooserMapping(Object) - adds data chooser mapping, it is relevant only for data chooser component, mapping object contains the following properties:
    1. id - mapping id
    2. description - mapping description
    3. variableId - id of the process variable, to which the selected value in data chooser is mapped
    4. name - the text displayed for the mapping when presenting the data chooser results on the task form
    5. hidden - indicates whether the mapping is to be hidden on the task form
    6. verify - indicates whether the mapping is to be validated on the task form
    7. readOnly - informs which values cannot be edited in a given mapping, accepted values are:
      1. true/false - variable of boolean type, indicates that none of the mapping values can be edited
      2. string - variable of type string, indicates which of the mapping values cannot be edited (accepted values are: id, description, variableId, name, hidden, verify)
      3. array - a table variable, informs which of the mapping values cannot be edited (accepted values are: id, description, variableId, name, hidden, verify)
  22. updateDataChooserMapping(id, Object) - updates data chooser mapping by id, it is relevant only for data chooser component, mapping object can contain the following properties:
    1. description - mapping description
    2. variableId - id of the process variable, to which the selected value in data chooser is mapped
    3. name - the text displayed for the mapping when presenting the data chooser results on the task form
    4. hidden - indicates whether the mapping is to be hidden on the task form
    5. verify - indicates whether the mapping is to be validated on the task form
    6. readOnly - informs which values cannot be edited in a given mapping, accepted values are:
      1. true/false - variable of boolean type, indicates that none of the mapping values can be edited
      2. string - variable of type string, indicates which of the mapping values cannot be edited (accepted values are: id, description, variableId, name, hidden, verify)
      3. array - a table variable, informs which of the mapping values cannot be edited (accepted values are: id, description, variableId, name, hidden, verify)
  23. removeDataChooserMapping(id) - removes data chooser mapping by id, it is relevant only for data chooser component
  24. changeDataChooserMappingPosition(id, position) - moves data chooser mapping by id, position starts from 0 and cannot be greater that mapping count -1, it is relevant only for data chooser component
  25. getAllDataChooserMappings() - returns list of all data chooser mappings, it is relevant only for data chooser component, each mapping object contains the following properties:
    1. id - mapping id
    2. description - mapping description
    3. variableId - id of the process variable, to which the selected value in data chooser is mapped
    4. name - the text displayed for the mapping when presenting the data chooser results on the task form
    5. hidden - indicates whether the mapping is to be hidden on the task form
    6. verify - indicates whether the mapping is to be validated on the task form
    7. readOnly - informs which values cannot be edited in a given mapping, accepted values are:
      1. true/false - variable of boolean type, indicates that none of the mapping values can be edited
      2. string - variable of type string, indicates which of the mapping values cannot be edited (accepted values are: id, description, variableId, name, hidden, verify)
      3. array - a table variable, informs which of the mapping values cannot be edited (accepted values are: id, description, variableId, name, hidden, verify)
  26. resetDataChooserMappings() - removes all data chooser mappings, only relevant for data chooser component
  27. addTable(Object, position) - adds the table at the specified position (use getFieldPosition function to determine the position for a field), the position parameter is optional, if not specified, the object is added at the last position, the table definition object contains the following properties:
    1. id - identifier of the table to hide/show/remove the field
    2. name - the name of the table
    3. description - description of the table
    4. hidden - determines whether the table is to be hidden
    5. blocked - determines whether buttons for adding/removing rows in the created table will appear, default: false
    6. notEmpty - determines whether all fields in the table must have at least one row added
      1. addField(Object / parameterId, position) - adds a table parameter field at the specified position, the position parameter is optional, if not specified, the object is added at the last position
      2. addCombobox(Object, position) - adds a drop-down list in the form of a table at the specified position, the position parameter is optional, if not specified, the object is added at the last position, for the definition of the drop-down list - see section 8.
      3. addRow([ Object ], position) - adds a new row to the table at the specified position, the position parameter is optional, if not specified, the object is added at the last position, the first parameter is optional and contains the values of each field in the table, the definition of the single value object is as follows:
        1. id - table field identifier
        2. value - the value of the field
      4. removeRow(position) - removes the table row at the specified position, the position parameter is optional, if not specified, the object is removed from the last one
      5. clear - clears the contents of the table
  28. addRow(position) - adds an empty row to the parameter fields arranged horizontally at the specified position, the position parameter is optional, if not specified, the object is added at the last position, the method returns the API for the row, which is the same as the V2 API (so adding more fields is implemented by the addField method from position 1.).
  29. disable(parameterId) - blocks the parameter field
  30. enable(parameterId) - unlocks the parameter field
  31. resetValue(parameterId, silent) - deletes the value of the parameter field, if silent is true, the onChange function is not executed after changing the value
  32. hasVariableValue(parameterId, position) -  indicates whether the parameter field has a variable as a value, the position parameter is taken into account for table and array fields, if it is given, it checks the value of only the field at a specific position, otherwise all currently added fields are checked
  33. hasVariableArrayValue(parameterId, position) - indicates whether the parameter field has a table variable as a value, the position parameter is taken into account for table and array fields, if it is given, it checks the value of only the field at a specific position, otherwise all currently added fields are checked
  34. hasFunctionValue(parameterId, position) - indicates whether the parameter field has a function as a value, the position parameter is taken into account for table and array fields, if it is given, it checks the value of only the field on a specific position, otherwise all currently added fields are checked
  35. setNotEmpty(parameterId, notEmpty) - allows you to set the value of the notEmpty property
  36. setErrorHandling(Object) - allows you to set the error handling of the system application, the function is available only for application components, the error handling object takes the following properties:
    1. type - string type, acceptable values are STOP and CONTINUE
    2. comment - string type or an object taken directly as a value of another parameter
    3. userMessage - string type or an object taken directly as the value of another parameter
    4. addErrorToComment - boolean type or an object taken directly as a value of another parameter
    5. setters - object containing the following properties:
      1. variables - an array of variable identifiers, string-type values or an object taken directly as the value of another parameter
      2. values - an array of variable values, string type values or an object taken directly as the value of another parameter
  37. block(parameterId) - blocks the ability to resize table and table fields (hides the add/remove field buttons)
  38. unblock(parameterId) - unblocks the ability to resize table and tabular fields (shows the add/remove field buttons)
  39. addEmptyLine(position) - adds an empty line at the specified position (use the getFieldPosition function to determine the position for the field), the position parameter is optional, if not specified, the object is added at the last position
  40. addFieldSet(Object, position) - adds a grouped set of fields at the specified position (in order to determine the position for the field, use the getFieldPosition function), the position parameter is optional, if not specified, the object is added at the last position, the definition object of the grouped set of fields:
    1. id - identifier of the grouped set of fields
    2. title - the title of the grouped set of fields
    3. collapsible - specifies whether the grouped set of fields can be collapsed and expanded, default: false
    4. collapsed - specifies whether the grouped set of fields is initially collapsed, default: false
  41. collapseFieldSet(id) - collapses the grouped set of fields
  42. expandFieldSet(id) - expands the grouped set of fields
  43. toggleFieldSet(id) - specifies whether the grouped set of fields can be collapsed and expanded, default: false
  44. addColorPicker(Object / parameterId, position) - adds a color palette at the specified position (use the getFieldPosition function to determine the position for the field), the position parameter is optional, if not specified, the object is added at the last position, the color palette can only be added to parameters of type STRING
  45. isDataChooserInTable(id) - returns true if the variable with the specified id is a dynamic list and is located in a table, otherwise returns false, it is possible to omit the id if we are currently in the edit process variable of the dynamic list type
  46. activateRebuildParameters() - activates the rebuilding of the dynamic parameter form after the occurrence of the following events
    1. change of position of the process variable of the dynamic list type
  47. deactivateRebuildParameters() - deactivates the rebuilding of the dynamic parameter form after the occurrence of the following events
    1. change of position of a process variable of the dynamic list type
  48. showMessage(Object) - displays a message in a pop-up with an OK button, the configuration object contains the following properties:
    1. message - message content
    2. title - the title of the window
  49. getAllTasks -returns a list of all tasks that currently exist in the process. The object of each task in the list has the following properties:
    1. id - task definition identifier
    2. name -  name of the task
  50. getAllRoles - returns a list of all roles that currently exist in the process. The object of each role in the list has the following properties:
    1. id - role identifier
    2. name - the name of the role
  51. getAllVariables - returns a list of all variables that currently exist in the process. The object of each table in the list has the following properties:
    1. id - variable identifier
    2. name - variable name
    3. type - variable type

      Variable typeValue passed
      StringSTRING
      Text areaTEXTAREA
      Date and timeDATETIME
      DateDATE
      IntegerINTEGER
      FloatFLOAT
      BooleanBOOLEAN
      AmountAMOUNT
      RadiobuttonRADIOBUTTON
      CheckboxCHECKBOX
      ListboxLISTBOX
      System users tableUSERLIST
      System users listUSERLISTLISTBOX
      Filtered users list with roleROLEUSERS
      Filtered users list with roleROLEUSERS_NO_FILTER
      Data chooser
      DATA_CHOOSER
    4. destination - variable placement

      Variable placementValue passed
      Formform
      Tabletable
  52. getAllGlobalTables - returns a list of all global dynamic tables that currently exist in the process. The object of each table in the list has the following properties:
    1. id - table identifier
    2. name - name (title) of the table
    3. columns - a list of identifiers of process variables, which were used as table columns
  53. getGlobalTable(tableId) - returns the definition of the global dynamic table, or null if there is no table with the specified identifier. The table object has the following properties:
    1. id - table identifier
    2. name - name (title) of the table
    3. columns - a list of identifiers of process variables, which were used as table columns
  54. showHint(parameterId, hint, type) - displays a hint under the given parameter/table. The function takes the following parameters:
    1. parameterId - parameter identifier, it can also be a table identifier
    2. hint - the content of the hint
    3. type - type of hint (responsible for the color of the text), available values are:
      1. INFO - black
      2. SUCCESS - green
      3. ERROR - red
  55. showHintInArray(parameterId, position, hint, type) - displays a hint under the given field in the table parameter. The function takes the following parameters:
    1. parameterId - parameter identifier, it can also be a table identifier
    2. position - index of the parameter in the table
    3. hint - the content of the hint
    4. type - type of hint (responsible for the color of the text), available values are:
      1. INFO - black
      2. SUCCESS - green
      3. ERROR - red
  56. hideHint(parameterId) - hides the hint under the given parameter/table
  57. hideHintInArray(parameterId, position) - hides the hint under the given field in the table parameter


Combobox API:

  1. addValues(Object/Array) - adds more positions to the drop-down list (see values in the addCombobox method), applies only to those drop-down lists that work locally
  2. setValues(Object/Array) - changes positions in the drop-down list (see values in the addCombobox method), applies only to those drop-down lists that work locally
  3. setUrl(url) - sets the url that returns data from the server, applies only to those dropdown lists that retrieve data from the server, the value of the url parameter must be of type String
  4. setForceSelection(forceSelection) - sets the value of the forceSelection field

WŁAŚCIWOŚCI POLA PARAMETRU (FIELD)

  • id
  • name
  • description
  • type
  • listeners
    • afterrender - function executed after the field is rendered (its value is already available), it takes the following parameters:
      • options - additional parameters passed to the function
        • rowIndex - if the parameter field is of table type, then rowIndex is the position of the current parameter field in the table, the first position has a value of 0
    • change
    • blur
    • select (for a drop-down list)
    • addfield (for an table-type field, the parameter is the position of the field)
  • hidden
  • disabled
  • optional
  • notEmpty
  • value
  • readOnly
  • hideLabel
  • disableVariableDuplication - for a field of table type, indicates whether to block the possibility of selecting the same variable in different fields of the table parameter
  • values -  list of drop-down list value objects, each object contains properties id (value identifier), display (value displayed in the list), description (description of the value in the list)
  • arrayMinLength - applies to table parameters, the minimum number of fields that must be added to positively validate the field, default value: 0 (the field is always positively validated)

FORM VALIDATION

It is possible to perform your own form validation. If the validateForm( api ) method is registered for the component, you will be able to check other conditions on your own, in addition to the standard validation of field requirements. The method should return false if the form saving process is to be aborted. In addition, you can return an object that, depending on the property set, will define other behavior:

  1. confirm: true - displays a window requiring confirmation to continue saving, additional properties of the object are:
    1. title - title of the confirmation window (default: Attention)
    2. message - the message displayed in the confirmation window

{
  confirm: true,
  title: 'Confirm saving',
  message: 'Do you want to continue saving?'
}

 

The API provided as a method parameter allows you to use the following functions:

  1. getFieldPosition(parameterId) - returns the position of the parameter field, if the parameter is in a table, the position of the table parameter field is returned
  2. getValue(parameterId, asString) - returns the value of the parameter field, the value can be returned as a string (asString=true)
  3. getArraySize(parameterId) - returns the number of fields in the table parameter or 0 if the field is not a table parameter
  4. hasVariableValue(parameterId, position) - indicates whether the parameter field has a variable as a value, the position parameter is taken into account for table and table fields, if it is given, it checks the value of only the field at a specific position, otherwise all currently added fields are checked
  5. hasVariableArrayValue(parameterId, position) - indicates whether the parameter field has a table variable as a value, the position parameter is taken into account for table and table fields, if it is specified, it checks the value of only the field at a specific position, otherwise all currently added fields are checked
  6. hasFunctionValue(parameterId, position) - indicates whether the parameter field has the function as a value, the position parameter is taken into account for table and table fields, if given, it checks the value of only the field at a specific position, otherwise all currently added fields are checked
  7. getFunctionReturnType(parameterId, position) - returns the type of the value returned by the function given as the value of the given parameter, the position parameter is taken into account for table fields, if given, it returns the type only for the field on a specific position, otherwise an array of types is returned
  8. getVariableType(parameterId, position) - returns the type of the variable given as the value of the given parameter, the position parameter is taken into account for table fields, if given, it returns the type only for the field on a specific position, otherwise an array of types is returned
  9. markError(parameterId, position) - marks the field as incorrect, the position parameter is taken into account for table and table fields, if given, it marks fields on a specific position, otherwise all currently added fields are marked
  10. showErrorMessage(errorMessage) - displays an error message
  11. showHint(parameterId, hint, type) - displays a hint under the given parameter/table. The function accepts the following parameters:
    1. parameterId - parameter identifier, it can also be a table identifier
    2. hint - the content of the hint
    3. type - type of hint (responsible for the color of the text), available values are:
      1. INFO - blak
      2. SUCCESS - green
      3. ERROR - red
  12. showHintInArray(parameterId, position, hint, type) - displays a hint under the given field in the table parameter. The function takes the following parameters:
    1. parameterId - identifier of the parameter, it can also be an identifier of the table
    2. position - index of the parameter in the table
    3. hint - the content of the hint
    4. type - type of hint (responsible for the color of the text), available values are:
      1. INFO - black
      2. SUCCESS - green
      3. ERROR - red
  13. hideHint(parameterId) - hides the hint under the given parameter/table
  14. hideHintInArray(parameterId, position) - hides the hint under the given field in the table parameter
 

STRING
updateDataChooserMapping
  • No labels

12 Comments

  1. Jak wygląda obsługa checkboxa?

  2. Checkbox może być dodany jako niezależny komponent na formularzu. Nie jest powiązany z żadnym parametrem, służy np. do pokazywania/ukrywania jakieś sekcji pól. Obsługa jest za pomocą przekazania obiektu w parametrze do funkcji addCheckbox, który definiuje metodę onChange.

    Planowane są kolejne zmiany, źeby powiązać to z parametrami. Aktualnie pracuję nad tym, co wskazał Tomek - combobox.

  3. Dodano obsługę combobox. Jeżeli jest w parametrze podane id, to zmienia pole parametru w listę rozwijaną (tylko dla zmiennych typu string), jeżeli nie ma podanego id, to tworzy niezależną listę rozwijaną, w której możemy podając onChange wykonywać różne akcje w zależności od wybranej wartości (do onChange przekazywany jest parametr value - id wartości wybranej z listy).

  4. Marek Mastyło, jedna uwaga (smile) Chciałbym, żeby dodane raz pole mogło być w locie zamienione w listę dynamiczną. Najprościej chyba byłoby sprawdzać przy wywoływaniu form.addCombobox(), czy pole zostało już dodane i podmieniać je zamiast tworzyć kolejny parametr z tym samym identyfikatorem (co pewnie w którymś momencie i tak zaowocowałoby błędem).

    1. Obsłużono. Co prawda w inny sposób. Raczej tego typu API tak nie działają, że podmieniają add, to add. Teraz jest tak, że sprawdzane jest zawsze, czy dane pole już istnieje. Jeśli istnieje, to dodawanie nie jest wykonywane, bo może to potem skutkować błędem. Pojawiła się natomiast metoda insertField/Label/Checkbox/Combobox, która pozwala wstawić dany parametr w dowolne miejsce. Należy jedna do wyznaczania parametru position wykorzystać funkcję getFieldPosition, gdyż uwzględnia to też wykonanie warunkowe itd. można się zdziwić wstawiając position samemu. Jeżeli chcemy wymienić jakieś pole, to powinniśmy dać najpierw remove, potem add/insert. Można by dać też funkcję replace, ale i tak ona zrobi to samo, co opisałem.

  5. Dodałem comboBox z dwoma tekstowymi wartościami do pola o id "format" i typie STRING:

    form.addCombobox({

                id : "format",

                values : [

                    { display: "PDF" },

                    { display: "DOCX" }

                ]

            });

    Po kliknięciu pojawia się lista rozwijana z dwoma wartościami, lecz po wyborze którejkolwiek z nich, moje pole zamienia swoją wartość na puste.

    Rozumiem, że poprawne działanie to zapisanie wybranej wartości do komórki? Jeżeli tak, to prośba o poprawienie (smile)

  6. Adrian Kozica, oprócz pola display dla wartości, potrzebujesz jeszcze pole "id", które, nota bene, przechowuje wartość i przekazuje ją dalej.

  7. Ok, testowałem wcześniej z id i miałem błędy, ale to widocznie jakieś moje przeoczenie, bo teraz wszystko działa jak należy (smile) Dzięki!

  8. Czy istnieje jakiś sposób aby zamiast małego pola, wstawić jakieś wieksze (htmlEditor, editor, pole tekstowe). do wprowadzani dużej ilości tekstu(szablonu).
    Aktualnie kombinuje  z htmlEditorem(dodany przez form.add({...}), aby na zdarzenie zmiany tekstu , odczytał wprowadzony tekst i ustawił pole docelowego parametru na ten tekst.

    1. Niestety obecnie PWE nie daje wsparcia dla tego typu komponentów. Być może uda się coś dodać, ale potem może się to różnie zachowywać.

  9. Funkcja addTable pozwala na dodanie w parametrze tablicy obiektów. Jak takie obiekty mają wyglądać? Chciałbym tam podać combobox rzutujący na jeden z parametrów, np:
    Tablica typu:

    WartośćTyp wartości

    Gdzie "Typ wartości" byłby listą rozwijaną (wartość tekstowa, liczbowa itd.)