CodeCharge Studio | All ASP PHP Perl ColdFusion Java C#.NET VB.NET |
When the List Source Type property of a list box is set to Table/View, the values that are used to populate the Listbox come from a database table or view. In this case, it is possible to use event code to specify the Where clause as well as the Order By clause which will be used in the SQL statement that retrieves records to be shown in the Listbox.
In our example, we have a Status List Box that is located in a Tasks Record form.
Function Tasks_Status_DataSource_BeforeBuildSelect(Sender) Tasks.Status.DataSource.Where = " status_id >2" Tasks.Status.DataSource.Order = " status_id DESC" End Function
function Tasks_Status_DataSource_BeforeBuildSelect(& $sender) { global $Tasks; $Tasks->Status->DataSource->Where = " status_id >2"; $Tasks->Status->DataSource->Order = " status_id DESC"; }
sub Tasks_Status_DataSource_BeforeBuildSelect() { $Tasks->{Status}->{DataSource}->{Where} = " status_id >2"; $Tasks->{Status}->{DataSource}->{Order} = " status_id DESC"; }
<!---Tasks_status_BeforeBuildSelect ---> <CFSET strWhereStatus=" status_id > 2"> <CFSET strOrderStatus=" status_id DESC">
//Tasks_Status_BeforeBuildSelect e.getCommand().setWhere(" status_id > 2"); e.getCommand().setOrder(" status_id DESC");
'Tasks_Status_BeforeBuildSelect CType(statusDataCommand,TableCommand).Where="age_id > 5" statusDataCommand.OrderBy="age_name"
//Tasks_Status_BeforeBuildSelect ((TableCommand)statusDataCommand).Where="age_id > 5"; statusDataCommand.OrderBy="age_name";