-- first method using creategroupfromquery function creating a recordgroup dynamically
declare
myrec RECORDGROUP;
begin
if not id_null(myrec) then
delete_group(myrec);
end if;
myrec := CREATEGROUPFROMQUERY('otmp','select decode(emp_grade,'S','Staff', 'W', 'Worker','') ,emp_grade from employee_master');
if poplatre_group(myrec) =0 then
clear_list('control.combolist1');
populate_list('control.combolist1',myrec);
end if;
end;
--second method, using a explicit cursor and add to list using add_list_element
declare
cursor rec is select decode(emp_grade,'S','Staff', 'W', 'Worker','') emp_grade_desc ,emp_grade from employee_master;
reccount number:=0;
clear_list('control.combolist1');
begin
for o in rec loop
add_list_element('control.combolist1',reccount,o.emp_grade_desc,o.emp_grade);
reccount :=reccount +1;
end loop;
end;
declare
myrec RECORDGROUP;
begin
if not id_null(myrec) then
delete_group(myrec);
end if;
myrec := CREATEGROUPFROMQUERY('otmp','select decode(emp_grade,'S','Staff', 'W', 'Worker','') ,emp_grade from employee_master');
if poplatre_group(myrec) =0 then
clear_list('control.combolist1');
populate_list('control.combolist1',myrec);
end if;
end;
--second method, using a explicit cursor and add to list using add_list_element
declare
cursor rec is select decode(emp_grade,'S','Staff', 'W', 'Worker','') emp_grade_desc ,emp_grade from employee_master;
reccount number:=0;
clear_list('control.combolist1');
begin
for o in rec loop
add_list_element('control.combolist1',reccount,o.emp_grade_desc,o.emp_grade);
reccount :=reccount +1;
end loop;
end;
No comments:
Post a Comment