Audience
  • Developers
  • Form Designers
Required Knowledge
  • Views
  • Rules and Rule Designer

Introduction

The latest How To topics are available in the K2 Five User Guide or the K2 Cloud User Guide’s How to section.

Parameters are used to parse data from one View to another or from a View to a subform. View Parameters are writeable, in other words it can be used as a variable to store values into and retrieve them again. View Parameters can be of type Boolean, DateTime, Number or Text. Parameters can have a default value or can be set by using Rules. Parameter values can be read by using the Expression Builder in the Context Browser. Another mechanism for setting the value of a parameter is to use the Transfer Data action within a Rule. The Mapping Destinations have been extended to include the Parameters so that they can be set. They also appear in the Context Browser so that these parameters can be Read in Rule Actions as well.

Implementation Details

View Parameters are available in the View Designer on the Parameters tab:

Image

The Finished screen of the View Designer has been extended to include the Run with Parameters option. When selecting to Run with Parameters, a screen will open in runtime requesting the parameter before opening the View. The user can specify the parameters in order to test/run the View. Below is an example of the screen:

Image

Select the Parameter, provide the value and click Run. The View will open. The View can also be viewed by accessing the URL at the bottom of the screen

Considerations

  • Values such as System Values, Tokens, Text and Context can be dragged from the Context Browser into the Parameters Mapping Destinations when using Rules to set Parameters.
  • Boolean values cannot be blank and will therefore default to False. Values accepted are:
    • 1 or 0
    • true or false
    • yes or no
  • The following HTML values are not allowed in the Parameters Name:
    • <

    • >

    • &
    • "
    • '
  • When running the View with Run with Parameters, and parameters of type Number and Boolean have been used, a default value is required
  • When using the DateTime parameter, the value cannot be typed and should be selected from the Calendar control
  • When editing the parameter, the user can double click the parameter to edit it as well

Example Scenario

We will use two Views containing parameters and transfer the data of the parameters between the two Views to populate controls on the subview. Follow the steps below to set up the scenario as described above:

  1. Create an unbound View called Parameter1. Drag 4 Data Label controls onto the View.
  2. Add a Button control to Parameter1 View.
    Image
  3. On the Parameters step add 4 parameters to the View. One parameter per type of parameter, e.g. Boolean. Save and Finish the View.
    Image
  4. Create an unbound View called Parameter2. Drag 4 Data Label controls onto the View.
  5. Once again on the Parameters step add 4 parameters to the View. One parameter per type of parameter, e.g. Boolean. Save and Finish the View.
    Image
    Image
  6. Create the following new Rule on Parameter1 View
    Events: When the View executes a method.
    Actions: transfer data.
    Image
  7. Configure the transfer data action as follows:
    Image
  8. Create another Rule on Parameter1 View to add a View parameter condition, then open a subview and transfer parameter data to the subview
    Events: When a control on the View raises an event
    Conditions: A View parameter has been specified
    Actions: Open a subview
     
    Image
  9. Configure the open a subview action as follows:
    Image
  10. Save and Finish the View.
  11. Create the following new Rule on Parameter2 View.
    Events: When a View executes a method
    Actions: Transfer data
    Image
  12. Configure the transfer data action as follows:
    Image
  13. Save and Finish the View.
  14. Run the Parameter1 View with Parameters and supply values for all parameters except for Param4.
  15. Click Run.
  16. Click on the Button control on Parameter1 View. The subview does not open as the condition has not been met.
  17. Run the Parameter1 View with Parameters and supply values for ALL parameters.
    Image
  18. Click Run.
  19. Note that the controls are populated with the parameter values.
    Image
  20. Click on the Button control. The subview opens and the controls are populated with the values as transferred from Parameter1 View.
    Image