How to use the Parameter Collector Operation

by Ombretta Malinverno
14,649 views Published on Jan 18, 2018
Applies to: 7.2 or higher
Table of contents

Introduction

The Parameter Collector Operation permits one to collect a set of parameters from multiple sources and to redistribute them to multiple targets. In this way, the operation reduces the model complexity by deleting some data flows, improving its reading and creating a neater model.

Configuring the Parameter Collector Operation

It is possible configure the parameter collector operation by adding the desired number of Collector Parameters. A Collector Parameter is an input/output parameter of the parameter collector operation. You can right-click on the operation and choose the Add > Collector Parameter option to add a parameter. Once added, give a meaningful name to it from its Properties View.

You should see the collector parameter inside a white rectangle in the parameter collector operation figure. It will also be shown as a child of the operation inside the Outline View.

Examples

Example 1: Use the Parameter Collector Operation in an operation chain

Suppose you want to create a model handling both the creation and updating of products, saving the related images and tech records.

The IFML model is related to the product management.

The model is composed of the "Products Management" page, including a list, a form and a multiple form components, and a "Save Product" action that saves the product information by calling the referenced action definition. If the saving procedure goes successfully, the product information is shown; otherwise, an error is shown.

Let's concentrate your attention on the "Save Product" action definition. This is the model without using the parameter collector operation.

This action definition receives the following as input parameters:

  • The "Product Key".
  • The "Product Object".
  • The "Image Object".
  • The "Tech Record Keys".

The "Product Key" is passed to the  "Product Exists?" is not null operation to check whether the product already exists or not.

If the key doesn't exist, the product is created by the "Create Product” operation; otherwise, the product is updated by the "Update Product" operation.

The images related to the product are deleted with the "Delete Photo Gallery" operation and created again using the "Create Photo Gallery" operation with the new connections.

The "Product to Tech Record" reconnect operation updates the connections between the product and the tech records.

Then, if the operation chain is successful, the action definition reaches the "Success" OK port.

The "Create Product" and the "Update Product" operations provide the product key to the three next operations that require its value.

The model with all the data flows turns out to be complex, especially if it could be integrated later, in which case it risks being even more complicated.

For this reason, you can use the parameter collector operation to reduce the data flows.

The "Collect Product Information" operation receives the new product key from the create operation or the existing key from the update operation and passes it to next operations.

Using this operation, you can reduce the modeled data flows and have an easier model.

Example 2: Use the Parameter Collector Operation with URL Fragments

The Parameter Collector Operation can use the URL Fragments because it enables having meaningful URLs for operation chains so that they can easily be invoked and dynamically generated.

The two properties you have to consider when applying the URL Fragments to a parameter collector operation are:

  • Custom URL Name. This is a meaningful name for the parameter collector operation.
  • URL Fragments. This enables getting and setting the list of the parameters specified on the parameter collector property that must be used by the URL.

Let's introduce URL Fragments for the parameter collector using the reset password process for users. Suppose that a user want to reset his or her password, and to complete the procedure, he or she uses the link present in the email. Refer to the example explained in the "How to Model Password Recovery" article, modeling the management related to the "Insert New Password page" section.

Assuming that the "code" attribute of the "User" entity is used to identify the user who wants to reset the password, it is possible to use this information to retrieve the user and see if he or she exists.

A meaningful URL can be something like the following:

http://<hostname>/<WebApplicationName>/reset/<code>

You need a model like the one shown in the picture to accomplish this example.

Use the following procedure to configure the parameter collector operation of this example:

  1. Add a parameter collector operation to the IFML model and give a meaningful name to it (e.g., "retrieve url entry point").
  2. The "Check reset code" action requires, as input, the code assigned to the user, so right-click on the operation, choose the Add > Collector Parameter option. Set the name to the new parameter (e.g., "code").
  3. Let's set the URL properties for the parameter collector operation.
    1. Set the Custom URL Name property to "reset".
    2. Press on the Select button for the URL Fragment property and select the "username" parameter. Then press the OK button.
  4. Bind the "code" parameter with the input parameter of the "reset url entry point" action.

Now in the generated Web application a user can register by following the URL, composed like this:

http://<hostname>/<WebApplicationName>/reset/<code>

The URL can be easily generated dynamically and used in emails or shown to newly registered users.

Example 3: Use the Parameter Collector Operation with the Jump Operation

Suppose you want to redirect a user to a specific page in another site view after an operation chain. For this purpose, you need to use the Jump Operation associated to the Parameter Collector Operation.

The following IFML model is related to the search product pattern where the user can decide to see the related details or edit the information from the resulting list.

The product management page is modeled on another site view of the Web Project (e.g., "Administration" site view). For this purpose, you need to use the jump operation to pass from one site view to another. In this case, the operation is associate with a "Go to Product Management" parameter collector operation present in the "Administration" site view.

The jump operation can pass the parameters to the parameter collector operation if it is needed. In this example, the product key is passed to allow the user to edit the information correctly.

When the user presses on the "Save" button, the product information is updated and the user is redirected to the "Home" site view, showing the product details. This management is also modeled in this case with the jump operation connected to the "See details" parameter collector operation.

How to use the sample project

You can use the "ParameterCollectorSample.zip" file attached to this article, to test the usage of the Parameter Collector Operation.

Follow these steps to use the project:

  1. Import the sample project into the WebRatio Platform. You can learn how to do this by watching the "Organize the Workspace" online lesson.
  2. Generate the project with the "Generate and Run on Cloud" command if you have a WebRatio Community Platform version; otherwise, use the "Generate and Run" command.
  3. Visit http://localhost:8080/ParameterCollectorSample/ or http://freeXXXXX-freeapp.eu.webratio.net/ with any browser, and follow the instructions to test the operation.