I'm trying to define a widget's datasource as the result of a query, but I'm not sure if it's posible.
I'm working with SQL views and a Table, I'd like to show the values of the IDs that I have on the table that come from the views.
function queryValue(source, model, key){
console.log("source " + source);
app.datasources[model].query.filters.id._equals = source;
app.datasources[model].load(function () {
console.log(app.datasources.users.items[0][key]);
return app.datasources.users.items[0][key];
});
app.datasources[model].query.clearFilters();
}
Calling it like:
queryValue(@datasource.item.[the_id], "[the_SQLView_Datasouce]", "[the_field_i_want]");
In this case the widget is a table, so the fucntion would repeat the amount of items in the talbe
The problem is that either I get the same result as meny times as the amount of items or the first one does not work!
And the second problem is that the result does not over write the widget text to show.
It's a very simple function and I did found some workarounds but not with the datasource feature and they work too slowly, any sugestions? Is it possible to do such thing with the datasource?