I have item and item_detail table. For item1, I have one detail record and for item2, I have two detail record.
On Step 1: Choose item which will be drop down from item table.
On Step 2: Based on item detail record count, I want to display text fields on step 2. If item1 is selected in step 1 thenl display, textdisplay1 and textfield1 in step2. If item2 is selected step ` will display textdisplay1, textfield1, textdisplay2, textfield2 in step2.
sql/pl/sql condition will be: select count(*) from item_detail where item_id in (select item_id from item where item_name='one provided in step 1'
I want this dynamic ability to display fields or atleast to hide textdisplay2,textfield2 based on sql/plsql condition.
Since I'm a newbie, here's how I'd try to approach this.
1) So we have the Selection List, say, :P1_SList
2) Then I'd create a Dynamic Action (DA) triggered on a change to :P1_SList.
3) The DA would have a PL/SQL procedure in the DA that computed (:P1_Disaplay_Number) 1 for text1, 2 for text2, ...
4) Then I'd have a display Condition -- a PL/SQL Function Body Returning a Boolean -- on each item (text1, text2, ...), something like, say for text3, ...
IF :P1_Display_Number <= 3 THEN
And so forth -- I hope my syntax is correct! So the item Condition determines whether the item displays.
5) You could set :P1_Display_Number to 0 initially, so no items display until the selection is made and the DA triggered.
(I hope you don't have more than 10-15 of these text1 ... text15.)
Is what I have described what you are trying to achieve?
:P1_Display_Number is a text box so condition will be:
select count(1) into cnt from obe.v_schedule_parameter where id = (select id from obe.v_schedule_program where program_name=:P2_X);
IF cnt = 1 THEN
-- disable :P2_textbox
IF cnt = 2 THEN
Searching for pl/sql syntax to disable :P2_textbox.
Fields / items display (or are hidden) by the result of the "Condition" selection on the APEX page specification for that field / item. (You have all those tabs at the top: Identification, User Interface, Grid Layout, Label, ..., Condition, ...) Condition determines if the field is displayed. It defaults to "- Item Not Conditional" but if you click the drop down, there are 30-50 different conditions. Exists, NOT Exists, ..., Never, Always. If you select "PL/SQL Function Body Returning a Boolean," it will add an Expression 1 box to the GUI where you can write a "Begin ... End;" block to return TRUE or FALSE for the condition. It display if TRUE is returned, hides if FALSE is returned. (Someone else chime in here if I've left something out.)
This is a VERY slick feature of APEX. The only addiitons I could ask for would be: Positive, Negative and "Do what I mean".