I’m playing with the SQL query tool and I found it very fast. I adapted the CRM example to my little order solution, adding a grand summary and everything worked fine.
Then I created a dialog box that shows a list of years and inserted the selected value into the query: it works.
Finally, I tried to substitute the fixed list of years with a dinamic set of values (I only want years having at least one order: this way, every query should be successful). So, I had the problem to retrieve the year values. I thought that SELECT DISTINCT function can do the job, but if I put the resulting dataset in a variable, I have the values separated by a return. If I want them to show in the dialog box, they have to be separated by commas. I tried using UtilsStringReplace, in order to replace returns with commas, but it didn’t work.
A little help?
In next build it will be possible to add dynamic pulldowns to your dialog using javascript arrays.
sample code:
var array = new Array(‘one’,‘two’,‘three’);
plugins.dialogs.showSelectDialog(‘Select’,‘please select a number’,array);
OR…
var maxReturedRows = 3;
var query = ‘select company_name from companies’;
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, maxReturedRows);
var array = dataset.getColumnAsArray(1);//put 1st column in array
plugins.dialogs.showSelectDialog(‘Select’,‘please select a name’,array);
maarten:
In next build it will be possible to add dynamic pulldowns to your dialog using javascript arrays.
sample code:
var array = new Array(‘one’,‘two’,‘three’);
plugins.dialogs.showSelectDialog(‘Select’,‘please select a number’,array);
OR…
var maxReturedRows = 3;
var query = ‘select company_name from companies’;
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, maxReturedRows);
var array = dataset.getColumnAsArray(1);//put 1st column in array
plugins.dialogs.showSelectDialog(‘Select’,‘please select a name’,array);
I tried to use it with 1.1.1b6, but I get an error telling me that “getColumnAsArray” is not a function.