Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Our first example is to create a form with a dropdown control that is dynamically populated with the above list of customers from the database. When the user selects a customer by name, the value of the dropdown control should be set to the customer number.

Image RemovedImage Added

The steps are as follows:

...

Next, we will add a drop down that displays the list of orders for a particular customer. When the user selects a customer name from the first drop down, we will display the list of orders for that customer from the database. This is essentially repeating the steps above except that the database query is triggered by a user action (selecting a customer from the drop down) and depends on the selected customer.

Image RemovedImage Added

Define a query

...

Create a business rule

  1. Click the Image Modified icon in the toolbar at the top of the Form Designer.
  2. Click Image Modified to create a new rule, then click the Image Modified Edit icon, Rule Code then click Edit Code to open the rule editor.
  3. Set the Name to 'Show orders'.
  4. In the Rule text area: copy and paste the following:

...

Now, we will display order details for any given order. For example, for order number 10397 above, the order details resultset is shown below.

Image RemovedImage Added

Since order details is a complex structure (product name, quantity, price etc.) we will use 's built-in XML features to generate controls and populate them from the database. When an order is selected, the order line items will be displayed as shown below:

Image RemovedImage Added

Define a query

...

Now, we connect the generated controls to the database query defined above. See Doc URl Wizards for help on the steps below.

  1. Click on the Doc Action button Form Properties Image Addedicon in the toolbar at the top of the form.
  2. In the dialog box that appears click on 'Select the Document Actions tab and the Send Data sub-tab.
    Image Added
  3. Select Manually set document URIs'.
  4. A new dialog box will appear. Click the Next button.
  5. You should see the Document name change to 'orderDetailsByOrder', which is the data source we are interested in.
  6. Set the URL to: http://localhost:8082/database/BIRT/orderDetailsByOrder?onum={so} (for standalone bundle with  Cloud, replace <server:port> with app.frevvo.com.)
  7. Set the Read method to GET.
  8. Click the Finish buttonSubmit.

Image RemovedImage Added

This step indicates to  that the 'orderDetailsByOrder' document is linked to the above URL via the READ method GET.  will issue an HTTP GET request to the above URL and if an XML document conforming to the schema above is returned,  will automatically initialize controls in the form using that document.

The URL itself is a dynamic URL and has a parameter indicated by {so}. Remember that we have a control in the form named 'so' (defined in this step. When the value of the control named 'so' changes (which will happen when the user selects a particular order),   will automatically issue an HTTP GET to the above URL using the new order number and will dynamically update the order details including creating new line items, removing old ones etc. without refreshing the form as shown in the picture below.

Image RemovedImage Added

Example 4: Create a new order

...

Create a business rule

  1. Click the Image Modified icon in the toolbar at the top of the Form Designer.
  2. Click Image Modified to create a new rule, then click the Image Modified Edit icon, Rule Code then click Edit Code to open the rule editor.
  3. Set the Name to 'Copy customer number and generate an order number'.
  4. In the Rule text area: copy and paste the following:

...

Now, we connect the generated controls to the database query defined above. See Doc URI Wizards for help on the steps below.

  1. Click on the Doc Action button Form Properties Image Addedicon in the toolbar at the top of the form.
  2. In the dialog box that appears click on 'Select the Document Actions tab and the Send Data sub-tab.
    Image Added
  3. Select Manually set document URIs'.
  4. A new dialog box will appear. Click the Next button.
  5. You should see the Document name change to 'createOrder', which is the data source we are interested in.
  6. Set the URL to: http://localhost:8082/database/BIRT/createOrder (for standalone bundle with  Cloud, replace <server:port> with app.frevvo.com.)
  7. Leave the Read method empty.
  8. Set the Write method to POST.
  9. Click the Finish buttonSubmit.

Image RemovedImage Added

This step indicates to  that the 'createOrder' document is linked to the above URL via the WRITE method POST. When the form is submitted,  will issue an HTTP POST request to the above URL sending the createOrder XML document in the payload. The database connector will map this to the <create> operation of the createOrder query that we defined above, will use the data in the XML document to resolve the query (replace {cnum} and {onum} with values from the XML) and perform the INSERT.

...