Re: How to get the element label in an List Item, Forms 4.5

From: Brian Membrey <horsemth_at_mel.switch.net.au>
Date: 1998/03/18
Message-ID: <01bd523e$17421a60$20a320cb_at_default>#1/1


It's horrible, but you need to search the list to determine the label (and index) The following code snippet should put you on the right track ... it searches the list for the currently selected value and returns the label  (I've hacked it out of another function, but it should be close to the mark)

FUNCTION GET_LIST_LABEL (from_list_name VARCHAR2) RETURN VARCHAR2 IS

 list_id        ITEM := FIND_ITEM(from_list_name);
 list_count     NUMBER;
 current_value  VARCHAR2(50);

 clicked_value VARCHAR2(50) := NAME_IN(from_list_name);  clicked_label VARCHAR2(50);
 list_not_found EXCEPTION;
BEGIN     IF NOT ID_NULL(list_id) THEN

    list_count := GET_LIST_ELEMENT_COUNT(list_id);     FOR i IN 1..list_count LOOP

        current_value := GET_LIST_ELEMENT_VALUE(list_id, i);
        IF clicked_value = current_value THEN
           clicked_label := GET_LIST_ELEMENT_LABEL(list_id, i);
           RETURN clicked_label'
           EXIT;
        END IF;

    END LOOP;
 ELSE
   RAISE list_not_found;
 END IF;
EXCEPTION
 WHEN list_not_found THEN
   MESSAGE('List name ' || from_list_name ||

           ' not found in GET_LIST_ELEMENT');    RAISE FORM_TRIGGER_FAILURE;
END; Jocke <hhh_at_abb.se> wrote in article <01bd50c0$ca60db10$d26add8a_at_pc2095>...
> Hello
>
> I've got a question about list items.
>
> I'm using a combo box to show values from a table
> where the column is an ID column and the shown labels
> are fetched into a record group from an other table.
>
> Is there a way to get the current label from the listbox ?
>
> The built-in GET_LIST_ELEMENT_LABEL can get labels out of
> a list item, but it needs a list_index as argument, and I do not
> know how to get this list_index for the current label.
>
> Thanks
>
> /Jocke
>
>
>
  Received on Wed Mar 18 1998 - 00:00:00 CET

Original text of this message