...
- if (form.load) - this implies that the rule will execute when the form first loads.
eval ('x=' + http.get('http://localhost:8082/database/BIRT/allCustomers')) - this causes an HTTP GET to be issued to the indicated URL. When invoked in the context of a rule, the media type is automatically set to JSON. As we saw above, the database connector will return the list of customers as a JSON object.
Info If using For the Standalone Database Connector with Cloud, replace localhost:8082 with "app.frevvo.com" in the URL.
- The rest of the rule is just JavaScript. We create an array of options in the format value=label (e.g. 242=Alpha Cognac) from the data returned in the JSON.
- Finally, we set the options of the dropdown to the array of options using the name we chose earlier (sc).
...