V7.3 – Dynamic pick lists & web services

One of the most common features our customers use is dynamic pick lists (or radio/checkbox controls). Examples abound such as a List of products for a Sales Order / PO, Number of available vacation days for a Leave Approval, List of projects for a Time Sheet and many others. With frevvo, you could always setup dynamic options using a business rule written in JavaScript.

/*member productCode, productName, resultSet*/
var x;
if (form.load) {
eval(‘x=’ + http.get(‘http://localhost:18080/database/BIRT/allProducts’));
var opts = [];
for (var i=0; i < x.resultSet.length; i++) {
if (x.resultSet[i]) {
opts[i] = x.resultSet[i].productCode + ‘=’ + x.resultSet[i].productName;
}
}
Products.options = opts;
}

V7.3 – no JavaScript

Products-WS

Selection Control connected to a web service

Starting with V7.3 (late August 2017), you can select an Options Source in the Properties pane for the selection control (drop down, radio or checkbox). By default, the Source is Design Time which simply means the choices are static and the designer specifies the list of options by typing them in at design time. But, you can now select Web Service. If you do that, three additional properties appear below:

 

  • Options URL: This is the end point for the web service. If you’re using the database connector,  it’ll be the same as the URL used in the JavaScript rule above. The assumption is that this call returns either XML or JSON.
  • Value binding: the path in the returned XML or JSON that determines the value of the select control (what’s in the submission).
  • Label binding: the path in the returned XML or JSON that determines the label of the select control (what the user sees).

That’s it. The URL can also be dynamic.

Edmunds

Selection control connected to the Edmunds API

For example, the screenshot at left shows a checkbox control that’s connected to the Edmunds API. The Options URL depends on the Year since that web service API returns Car Makes for a particular year. The URL is set to:

https://api.edmunds.com/api/vehicle/v2/makes?state=new&year={Year}&view=basic&fmt=json&api_key=<key hidden>

When the user types something in Year, the web service is automatically called, the results are refreshed and the choices in the Car Makes checkbox will change based on whatever the web service returned.

V7.3 will be released at the end of August. Visit our website and sign up for a free 30-day trial if you’d like to learn more or contact us for more information.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: