Versions Compared

Key

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

...

  • Click the Rules button in the toolbar at the top of the Form Designer.
  • Edit the Show Customers rule we created in Example 4. Change the name to Show Customers/Products.
  • In the Rule text area: copy and paste the following:

Code Block
/*member customerName customerNumber productCode productName resultSet */
var x;

if (form.load) 
{
  eval ('x=' + http.get('http://localhost:8082/database/BIRT/allCustomers'));
  var opts= [];
  for (var i=0; i < x.resultSet.length; i++) {
    if (x.resultSet[i]) {
      opts[i] = x.resultSet[i].customerNumber + '=' + x.resultSet[i].customerName;
    }
  }
  sc.options = opts;
  // Products.
  eval ('x=' + http.get('http://localhost:8082/database/BIRT/allProducts'));
  opts= [];
  for (var i=0; i < x.resultSet.length; i++) {
    if (x.resultSet[i]) {
      opts[i] = x.resultSet[i].productCode + '=' + x.resultSet[i].productName;
    }
  }
  pc[0].options = opts;
}

...