Versions Compared

Key

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

...

  1. Click the Rules mode in the Guided Designer navigation bar.
  2. Click to create a new rule. 
  3. Set the Name to 'Show customersGet Account Manager ID'.
  4. Select Rule Code then click Edit Code to open the rule editor.
  5. In the Rule text area: copy and paste the following:

    Code Block
    /*member accountMgrId, resultSet*/
    var x;
    eval ('x=' + http.get('http://localhost:8082/database/customers/getAccountMgrId?cnum=' + sc.value));
    for (var i=0; i < x.resultSet.length; i++) {
    if (x.resultSet) {
    AccountManagerID.value =  x.resultSet[i].accountMgrId;
    }
    }

    This rule runs the http.get and sets the query template 'cnum' to the value of our Select Customer ('sc') control from Example 1. This will resolve the customerNumber. The query runs the SELECT statement, which gets that customer's Account Manager ID, and sets that value in the text control 'AccountManagerID'. If you were to use this form in a workflow, you might have an Account Manager Review step assigned to the templatized string {AccountManagerID}, dynamically routing the correct Account Manager for this customer.

    Expand
    titleClick here to see this used in a Workflow Step Assignment...


...

  1. Make a copy of the form from Example 2 above and open it for editing.
  2. In the properties panel on the left, open the Data Sources pane by clicking on it.
  3. Click 'New from XSD'.
  4. You should see your schema in the resulting dialog box. Expand it and add the 'orderDetailsByOrder' element to the form by clicking the + icon next to it.
  5. Close the dialog box by clicking X in the top right corner.
  6. In the Data Sources pane, click the green + icon next to on the right of the orderDetailsByOrder data source. frevvo will generate controls in the form.
  7. You can drag and drop to re-arrange as you wish.
  8. Change the label of the Section named 'row' to the string '{product}'. We'll explain this in more detail below.
  9. Collapse this Section.

...

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 Modifytheform 1069269128. When the value of the control named 'so' changes (which will happen when the user selects a particular order), frevvo  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.

...

  1. Go to the Settings mode in the Guided Designer navigation bar.
  2. Select the Document Actions tab and the Send Data sub-tab.
  3. Select Manually set document URIs.
  4. You should see the Document name 'createOrdercreateOrderDetail', which is the data source we are interested in.
  5. Set the Write URL to: http://localhost:8082/database/BIRT/createOrderDetail
  6. Leave the Read method empty.
  7. Set the Write method to POST.
  8. Click Submit.

...