Page 1 of 1

Value list should have option to put sql query

PostPosted: Fri Apr 17, 2009 1:37 pm
by pradiptab
Hi all,

Whilw creating value list, there should be option for putting sql query, to fetch data.
It is possible by creating value list at run time by fetching data through query.
But this facility of putting a complex query at the time of creation of the value list will save time and will be easy to use


Regards,
Pradipta

Re: Value list should have option to put sql query

PostPosted: Tue Apr 21, 2009 9:37 pm
by rgansevles
Pradipta,

Have a look at application.setValueListItems() in combination with databaseManager.getDataSetByQuery()

Rob

Re: Value list should have option to put sql query

PostPosted: Mon Sep 21, 2009 11:04 am
by lwjwillemsen
Rob,

Please read the request of Pradipta again. He says he knows you can do it at runtime.

Lambert.

Re: Value list should have option to put sql query

PostPosted: Tue Sep 22, 2009 1:24 pm
by ngervasi
Hmmm, usually a complex query requires parameters and in my experience most of the time the parameters are not constants but variables that need to be evaluated at runtime, how would you handle that in the VL definition dialog?
If all the parameters you need are constants you can already define the valuelist using relations and global relations in the dialog.

Re: Value list should have option to put sql query

PostPosted: Tue Sep 22, 2009 1:57 pm
by ROCLASI
I guess what would be nice is to be able to set a filter (i.e. the WHERE clause) on a valuelist. This way you don't have to resort to using relations with globals.
Just a thought.

Re: Value list should have option to put sql query

PostPosted: Tue Sep 22, 2009 3:06 pm
by jcompagner
you could always create a feature request in our support system

Re: Value list should have option to put sql query

PostPosted: Tue Sep 22, 2009 3:27 pm
by martinh
I'm afraid if you make valuelists by query, that it will affect your performance, because it would execute each time you use the valuelist.

I use queries to fill most of my valuelists, using a dataset

Code: Select all
var _id_array = _ds.getColumnAsArray(1)
var _desc_array = _ds.getColumnAsArray(2)

application.setValueListItems( 'myValuelist',  _desc_array, _id_array);


And I only refresh the valuelist in case that I think it is useful.
Data that is almost static , I load once using the onLoad of the form where it is needed. So during the time my application lives, this kind of valuelists are not reloaded again.

So even when it can be handy to have valuelists by query, I'm afraid from performance point of view, it would perhaps be better not to do it like this.

Re: Value list should have option to put sql query

PostPosted: Tue Sep 22, 2009 4:30 pm
by ROCLASI
jcompagner wrote:you could always create a feature request in our support system

Feature request added under #244100 for the valuelist filter option.