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!

hide/unhide depending on selected value from LOV into text item

Status
Not open for further replies.

hudo

Programmer
Dec 4, 2003
94
DE
Hello,

after selecting a value from a LOV into a text item, I'd would like (depending on the selected value) to hide/unhide or lets say switch "what is displayed" on a certain canvas-tab. For example on the dedicated tab is scott.emp displayed and by selecting the value "Show table dept" from the LOV (which is of course displayed on "the main page") the scott.emp should be hided and scott.dept should be displayed on the dedicated tab.

How could this be implemented ?
 
What I'm looking is "the right trigger".
The LOV-Button has a ITEM-TRIGGER WHEN-BUTTON-PRESSED
with at least the following code:

GO_FIELD('STATUS_LIST.STATUS_IO');
DO_KEY('LIST_VALUES');

But at this stage there is no value assigned to the field
STATUS_LIST.STATUS_IO .
Which Trigger should I use at the STATUS_LIST.STATUS_IO - item
or even the LOV-Button to start the hiding/unhiding action ?

A first approach (code) would be:
Code:
----------------------------------------------
DECLARE
	
	tp_id	TAB_PAGE;
	tp_name	VARCHAR2(30);
	

BEGIN

IF    (:STATUS_LIST.STATUS_SWITCH LIKE '%not%')  THEN
-- no hide/unhide action
NULL;

ELSE 

--- hide emp display
tp_id := FIND_TAB_PAGE('EMP_TABLE');
SET_TAB_PAGE_PROPERTY(tp_id, visible, property_false);

--- unhide dept display
tp_id := FIND_TAB_PAGE('DEPT_TABLE');
SET_TAB_PAGE_PROPERTY(tp_id, visible, property_true);


GO_BLOCK('DEPT');

--- set DEFAULT_WHERE clause for DEPT depending on
--- value of TEXT ITEM :STATUS_LIST.STATUS_IO

IF  (:STATUS_LIST.STATUS_IO NOT LIKE '%not%')  THEN
	SET_BLOCK_PROPERTY('DEPT' ,DEFAULT_WHERE ,   .... );
EXECUTE_QUERY;

ELSE 

    SET_BLOCK_PROPERTY('DEPT' ,DEFAULT_WHERE ,   ....  );
EXECUTE_QUERY;

END IF;   ---DEFAULT_WHERE

END IF;   ---switch

END;
--------------------------------------
But which Trigger should I use ??
 
Hello HimanB,


I tried already the WHEN-VALIDATE-ITEM Trigger (on Item STATUS_LIST.STATUS_SWITCH ), but this leads to the error
FRM-40737: Unallowed GO_BLOCK in WHEN-VALIDATE_ITEM Trigger.

I should have mentioned it before, sorry.
 
Have you tried your code in KEY-LISTVAL after the LIST_VALUES built-in?

[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Systems Project Analyst/Custom Forms & PL/SQL - Oracle/Windows
 
Well I tried it as follows:


1) first put your code to be executed in a forms procedure.
2) Remove the LOV name from item's property. (you are going to display LOV programmatically)
3) Define a KEY-LISTVAL trigger on the item. Use Show LOV built-in to display the List. If a value is choosen then call your forms procedure

/*

** Built-in: SHOW_LOV
** Example: Display a named List of Values (LOV)
*/
DECLARE
a_value_chosen BOOLEAN;
BEGIN
a_value_chosen := Show_Lov 'my_employee_status_lov');
IF a_value_chosen THEN
-- ******Call your code here*********
END IF;
END;


With Forms 6i it works fine, with Forms 10g I get an error:
FRM-92101
But I think there should be another reason for this error, not the programmatically display of the LOV, or am I wrong ??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top