With MashZone 1.0.1 “dynamic data source parameters” are supported. As mentioned earlier, this sounds boring, but is quite useful. To explain, I made a MashApp that provides some basic information about the countries of Europe.
You can select a country in the combo box and then some information as the name of the capital, the population, the area and a list of regions is displayed.
Let’s focus on this list: If you select “Germany” as country, so will see there the “Bundesländer” of Germany as Bavaria, Baden-Württemberg or even Saarland. When you select a different country, for example France, you will see departments as Alsace, Bourgogne or Champagne. This list is queried with the parameter of your selection in the moment you change the selection of the combo box. This is why it is called “dynamic data source parameters” ;-)
Let’s have a closer look, how it works. I use the API from GeoNames.org that provides the list of regions for a given country. E.g. by calling http://ws.geonames.org/children?geonameId=2921044 you get an XML file containing the Bundesländer of Germany. “2921044” is the ID of Germany and it is obviously the parameter to the API call. So I built the following feed:
The key idea is that the value of the query parameter “geonameid” is not fixed but the URL is determined during runtime. To be able to so, this parameter is made a “User input text” called “geonameid” to the feed and passed to the data source using the “Create URL” operator. As a result, each time the value of the parameter “geonameid” changes, a new query is made calling the data source with this parameter and the new results are provided by the feed output.
And this is really powerful, as you can see here: The combo box with the names of the European countries is fed by this feed (without parameter, hence returning the European states as result as “6255148” is set as default in the feed):
Additionally to the names, also the “geonameid “ is fed into the combo. If you select now a country from the list, the corresponding geonameid is used to trigger a new query and display the results in the regions table:
Please note that the selection if the combo box is not used as filter, but as input to the feed. You can make this assigment by clicking on "Filter data" of the feed, but then selecting "user input" instead of "data feed column":
You can find the MZP of this MashApp attached. I think this passing of parameters is very powerful and I am sure you will have a lot of use cases within your own MashApps.
Keep on Mashing!
Tobias
Sure it is. Please keep in mind that docking points on the right (and left) hand side represent single values. In contrast the docking points on the upper and lower represent an entire table.
To draw the connection intended in the screenshot you need to convert the data feed result into a single value.
Tobias,
This is excellent - although I am not famililar with uses of api's / url's... Could you explain some basics here to work around real-time data from an internet source, and linking to Mashzone's url:
1) How do you make 'calls' from an api? What is a "call"?
2) What is the best way of finding api's on the net? (It does not seem to me obvious on geonames website, for example, where api's are stored, and how do we understand there is a link to a real time source? )
3) More importantly, how do you create your own url? - mainly to receive real-time data from a source or database? (very interested in boiler real-time stuff you did!)
Thanks in advance.