Home » Developer & Programmer » Forms » Getting value from list_element_value (Oracle forms 10g)
Getting value from list_element_value [message #502744] Fri, 08 April 2011 13:41 Go to next message
MarkH
Messages: 1
Registered: April 2011
Junior Member
I created this because I have a double click trigger that takes values from another list and adds them to this list but I did not want them to be adding duplicates to the selected list. I can never get the Get_List_Element_Value to return anything. The count of elements is correct and I add elemets to the list just fine but when I loop through them to ensure the value I am adding is not already there. Nothing happens and I keep adding duplicates all day. Any sugestions as to what I am doing wrong?

THanks in advance.

Mark

PROCEDURE Fill_Add_selected_userid(lvUsertoadd Varchar2) IS
--lvUsertoadd Varchar2(40) ;
lvcnt number;
lvLiCnt number;
--BEGIN
-- lvcnt := Get_List_Element_Count( 'BLOCK69.LIST68' );
-- lvLiCnt := lvcnt + 1;
--lvUsertoadd := Get_List_Element_Value('STN_DBUSERROLE.DB_USERID', inLItem ) ;
-- Add_List_Element('BLOCK69.LIST68', lvLiCnt, lvUsertoadd, lvUsertoadd ) ;
--------------
total_list_count NUMBER(2);
loop_index_var NUMBER(2) := 1;
list_element VARCHAR2(50);
list_element_value VARCHAR2(1024);
list_element_label VARCHAR2(1024);
list_element_to_add VARCHAR2(1024);
list_value_to_add VARCHAR2(1024);
element_match VARCHAR2(5) := 'FALSE';
value_match VARCHAR2(5) := 'FALSE';

RECORD_GROUP90 RECORDGROUP;


BEGIN


/*
** Determine the total number of list elements.
*/


message('Passed In Value:'||lvUsertoadd||'::');
total_list_count := Get_List_Element_Count('BLOCK69.LIST68');
message('total_list_count:'||total_list_count);
list_element_to_add := lvUsertoadd;
-- message(list_element_to_add );

lvLiCnt := total_list_count;
message('lvLiCnt:'||lvLiCnt||'::');
IF lvLiCnt > 1 THEN
lvLiCnt := lvLiCnt + 1;
else
lvLiCnt := 1;
END IF;

message('lvLiCnt:'||lvLiCnt||'::');

/*
** Compare the current list item values with the value that
** will be added.
*/
loop_index_var := 1;
value_match := 'FALSE';
list_element_value := null;
LOOP


message('loop_index_var:'||loop_index_var||'::');
message('Get_List_Element_Value:'||Get_List_Element_Value(':BLOCK69.LIST68',loop_index_var)||'::');
list_element_value := trim(both from Get_List_Element_Value(':BLOCK69.LIST68',loop_index_var));
message('list_element_value:'||list_element_value||'::');
message(nvl(list_element_value,'Value did not get found!!!!'));
loop_index_var := loop_index_var + 1;
--
IF list_element_value is null THEN
value_match := 'FALSE';
END IF;
IF trim(both from list_value_to_add) = trim(both from list_element_value) THEN
value_match := 'TRUE';
END IF;
EXIT WHEN list_element_value = list_value_to_add OR
loop_index_var >= total_list_count; --OR
--list_element_value is null;
END LOOP;
/*
** Add the element and value if it is not in the current list
*/
-- IF element_match = 'FALSE' AND value_match = 'FALSE' THEN

IF value_match = 'FALSE' THEN
message('About to add List Item');
Add_List_Element('BLOCK69.LIST68',lvLiCnt , list_element_to_add, list_value_to_add);
commit;
END IF;

--------------

Exception
When Others then
NULL ;
message('Ahh Haa! An error!!!!!');
END Fill_Add_selected_userid;
Re: Getting value from list_element_value [message #502752 is a reply to message #502744] Fri, 08 April 2011 15:30 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Code you posted is badly formatted, contains commented code (that distracts attention). Could you repost it, but this time omit anything that doesn't belong here and format it (if you don't know how, take a look).

A note or two: as you use Forms 10g, you don't really need all those MESSAGEs - run a form in debug mode (put a breakpoint at the beginning of this procedure (right click the margin)). Debugger will show you all those values (and many more).

Exception handler you use is useless. If there really is an error, you won't know which one. Use WHEN OTHERS only when you *know* why you use it. Otherwise, it'll cause a headache.
Previous Topic: Scenario
Next Topic: Report through Form
Goto Forum:
  


Current Time: Tue Sep 17 03:14:47 CDT 2024