Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

access name and value of double-clicked item

Status
Not open for further replies.

hudo

Programmer
Dec 4, 2003
94
DE
Hello,

I'd like to switch to a determined canvas-tab if I double-click on a specified item in a form. For example, my primary form displays the table scott.emp .By Double-clicking on a SAL-Item it should switch to the second/another tab where all records from scott.emp are displayed, which fulfill a where-condition which is written in the Block WHEN-MOUSE-DOUBLECLICK Trigger (lets say all entries with sal >= clicked sal-value).

By Double-clicking on a DEPTNO-Item it should switch to the second/another tab where all records from scott.emp are displayed, which fulfill a where-condition which is written in the Block WHEN-MOUSE-DOUBLECLICK Trigger (lets say all entries with deptno >= clicked deptno-value).... etc..

This is the code of the trigger:
---------------------------------------------------------

DECLARE
the_button_pressed VARCHAR2(1);
--my_current_value_dept VARCHAR(2);
--my_current_value_emp VARCHAR(10);

cur_blk VARCHAR2(40) := :SYSTEM.CURSOR_BLOCK;
cur_rec NUMBER;
--top_rec NUMBER;
bk_id BLOCK;


L_STR VARCHAR2(2000) :=' WHERE 1=1 ';

my_current_item VARCHAR2(100);
my_current_value VARCHAR2(100);

BEGIN

bk_id := FIND_BLOCK( cur_blk);
cur_rec := GET_BLOCK_PROPERTY( bk_id ,CURRENT_RECORD);
--my_current_value := cur_rec;

--my_current_value := :SYSTEM.CURRENT_VALUE;
--my_current_value_dept := :EMP.DEPTNO;
--my_current_value_emp := :EMP.SAL;


my_current_item := :SYSTEM.CURSOR_ITEM;
my_current_value := :SYSTEM.CURSOR_VALUE;
message('System_item'||:SYSTEM.CURSOR_ITEM||' '||my_current_item);
message('System_value'||:SYSTEM.CURSOR_VALUE||' '||my_current_value);

the_button_pressed := :SYSTEM.MOUSE_BUTTON_PRESSED;

-- L_STR := L_STR ||' AND '||my_current_item ||' = '||my_current_value;

L_STR := L_STR ||' AND '||my_current_item ||' LIKE ''%'||my_current_value ||'%''';


GO_BLOCK('EMP2');
CLEAR_BLOCK(NO_VALIDATE);

SET_BLOCK_PROPERTY('DEPT1', DEFAULT_WHERE, L_STR);
EXECUTE_QUERY;


END;

The message-lines display always the correct values for my_current_item and
my_current_value but then follows the error FRM-40505.

Another problem: I use the "complicated statement" with LIKE as a workaround because in some other forms occured some errors with the "simple statement" (with some values it did not work, I prooved also, if there are some "spaces" in the "not working values", but that was alright)

How can I access the name and the value of the double-clicked item to use it afterwards in the default-where clause ??

What may be the reason that "some values are not working" (so I used the LIKE statement as a workaround) ??

Thanks in advance
 
Try changing

L_STR := L_STR ||' AND '||my_current_item ||' LIKE ''%'||my_current_value ||'%''';

to

Code:
L_STR := L_STR ||' AND :'||my_current_item ||' LIKE ''%'||my_current_value ||'%''';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top