Quantcast
Channel: ATeam Chronicles
Viewing all articles
Browse latest Browse all 376

PCS Web Form Tips and Tricks – Part 3

$
0
0

In part 1 and part 2 of my blog series, I have discussed and highlighted some tips and tricks of using layout and input controls in web form.  In part 3, I will discuss and share some of the tips that will be useful to you when you add some dynamic behaviors using events in web form.  Different controls have different behaviors/event, you can read the PCS official documentation for more details.

Using connector in an event

You can use REST connector in an event. To use the rest connector, you will need to first define the REST connector in PCS composer->Application Home->Integrations. After you have defined the connection, the connector will be available for selection when you define the event.

webform-img19

Tips:

  • The response variable name must be in lower case.
  • If the response is an array type element, then, when you map the array data type to the control, the control must be an array type control like table or repeatable section. For example, if you have a table with 2 columns (supplier name and postcode) and the REST Service connector will return an array of objects in the REST response, when you map the response data to the table, you can assign the REST object field to the table column name.

webform-img20

webform-img21

Using action in a table/repeatable section

Table and repeatable section are array data type. Event action allows you to traverse through an array data type:

  • Self – Reference to the entire table/repeatable control
  • First- First item in the table/repeatable section control
  • Last – Last item in the table/repeatable section control
  • Selected – The current user selected Item in the table/repeatable section control, user must click on the item for this action to function.

There are a number of control actions you can defined in the table and repeatable section control.   Some of the actions allow you to change the property of the control like value, enable or disable the control etc.., some actions provide extra functionality, for example: Add Row, which you can use to add a row dynamically. Clear Value – which you can use to clear a value.

webform-img23

Tips:

  • It is not possible to reference to current item in an array using “On Load” event. If you need to access the current item in a repeatable section or table, you can add a section in a repeatable section with “Expanded” unchecked. On the section property, create an “On Expand” event with Which? = “Selected”.  With this event setting, user must click to expand the section for the action to be activated on the selected item.

webform-img22

    • You can use action to change the property of the control during runtime. For example, you can dynamically enable/disable the property “Allow Add/Remove Rows” using event to add and remove rows during runtime.

webform-img24

  • If the table or repeatable section data is from a REST connector, you can also use action to refresh the REST connector, the REST call will be fired again to refresh the data for the control.

webform-img25

Using condition and functions

Web Form allows you to configure If/Then/Else condition for an action or connector.  Please read the PCS documentation for more details about the condition function.

Functions are useful when you need to perform an operation with the data.  Please read the PCS documentation for more details about the common functions in PCS Web Form.

Tips:

  • Avoid complex conditions and business logic in PCS Form.
  • Split the event into multiple small manageable events. For example, you can define multiple on Load events. However, when you define operations to overwrite the value of a control using multiple event of the same type (like on Load), the output of the last defined event will be the final value. For example, if you defined 2 “On Load” events, and both events update the same input text control, the second “On Load” event will define the final value of the input text control.
  • The replace function takes 3 parameters, the second parameter supports regular expression.

webform-img26


Viewing all articles
Browse latest Browse all 376

Trending Articles