Press "Enter" to skip to content

Shifting List Item Values From One List To Another In Oracle Forms

Suppose you have two T-List items in form and you want  to shift element values from one list to another in Oracle Forms, here is the example given below for the same. Create two buttons also between list items as shown in picture in the bottom of this blog. Create one button with label “>” and another with label “<“.

When-button-pressed trigger code for button with label “>”:

declare
    n number;
    vval varchar2(100);
begin
    — replace rightsidelist with your list name placed on right side
    — replace leftsidelist with your list name placed at left side
      n := get_list_element_count(‘rightsidelist’);
      add_list_element(‘rightsidelist’, n + 1, :leftsidelist, :leftsidelist);
      — delete element
      n := get_list_element_count(‘leftsidelist’);
      for i in 1..n loop
            vval := get_list_element_value(‘leftsidelist’,i);
           if vval = :leftsidelist then
                   delete_list_element(‘leftsidelist’,i);
           end if;
      end loop;
end;

When-button-pressed trigger for button with label “<“:

declare
    n number;
    vval varchar2(100);
begin
      n := get_list_element_count(‘leftsidelist’);
      add_list_element(‘leftsidelist’, n + 1, :rightsidelist, :rightsidelist);     
     
      — delete element
      n := get_list_element_count(‘rightsidelist’);
      for i in 1..n loop
            vval := get_list_element_value(‘rightsidelist’,i);
           if vval = :rigtsidelist then
                   delete_list_element(‘rightsidelist’,i);
           end if;
      end loop;
end;

See also: Create List Item In Oracle Forms

One Comment

  1. Clement Clement June 11, 2013

    Nice.

    When-button-pressed trigger for button with label "<":

    if vval = :rigtsidelist then

    spelling mistake.

    if vval = :rightsidelist then

Comments are closed.