you have to do the following
the region decisions must be refreshed. When it will refresht depends on your logic (changes)
write a pl/sql function that returns a value of 1 if the button is to be displayed and 0 if not.
function check_final_decistion return number as l_result varchar2(255); l_return number; begin select decistion_name into l_result from dua; -- here must be your table and conditon if l_result != 'En attente' then l_return := 0; else l_return := 1; end if; return l_return; end;
create a hidden item like PX_final_decision_condition
Creating Dynamic action (After Refresh)
select region that was refreshed
in ture set value by plsql expression
insert your check_final_decistion function
affected elements PX_final_decision_condition
Fire on page load/inizialization
execute pl/sql code
in the plsql block write null;
and set page items to submit with PX_final_decision_condition
fire on page load no
PX_final_decision_condition gets dynamic action on change
in true show edit button contition set to 1
in hide edit button fire on pageload or inizialisation = yes depends on which APEX version you are using.
so I have included it in my applications.
the server side condition is evaluated only once on page load. If the server-side condition is not met, the object (item, button, region...whatever) is not rendered at all. For this purposeSelection Type you need to create a Dynamic Action on your PX_FINAL_DECISION item as follows:
Selection Type: Item(s)
and a Client-side Condition
Type: Item = Value (item and value is hopefully obvious and also consider if Enable/Disable true action would not be more appropriate).
Then create a true action Show => Button => Your button and finally left-click your true action and from the popup-menu choose create an opposite action (which will create a hide true action if the client-side condition is not met).
Thank you for reply HALABCH, but i get error in the PL/SQL block:
ORA-06550: line 1, column 97: PLS-00103: Encountered the symbol "CHECK_FINAL_DECISION" when expecting one of the following: . ( * @ % & = - + ; < / > at in is mod remainder not rem <an exponent (**)> <> or != or ~= >= <= <> and or like like2 like4 likec between || multiset member submultiset
Thank you Pavel_p, but doing this instructions, i still have same issue , the edit button is hide/show after refresh all page(clicking f5)
Since actually, I have 2 Pages:
- Page 3 (is page that i sent):The value of Final Decision is get from Classic Report, and the EDIT_DECISION button is used in Page3
- Page 4: when i click on EDIT_DECISION button (Page3), im redicted in the Page4(Modal Dialog), that set value of P4_Final_Decision.
So, once i click in SAVE button (Page4), the Dialog is closed and, the Page 3 is refreshed, and normally if the value of P4_Final_Decision IS NOT 'En attente' the EDIT_DECISION button should be hide.
I hope that I was clear now.
Dear soukaina i didn’t test that code example. It wa to show you how the function can look like behind the function name you have to set ()
You probably just need to set the Fire on Initialization attribute of both of your true actions to Yes. If it does not solve your problem, please, create a showcase on apex.oracle.com.
I did a example in apex.oracle.com, with another data, using projects, but the meaning is same:
So if status of project is closed , the edit button should be hide, else show it
Sorry, there is no app_id=44 in your workspace, so I copied one of your applications to Application 105782 - EDIT BTN_pp, open Region 2 and click the Open prj button => the modal dialogue opens. There is a conditional DA bound to the P2_STATUS LOV that hides/shows the Edit button. Hopefully this demonstrates how to hide/show a button based on the selected value (for other item types it works the same way).
supplement: change the sl status. if you on waiting the edit button will be hide els show
Yes the Application 103269 - EDIT BTN (that i created) is not 44.
Thank you for all your reactivity Pavel_p and Tim Halbach,
But my need :
Is to use 2 pages:
PG1: display data in top and in Region 2, and EDIT button existing in Region 2 (Show/Hide depending of STATUS value(that be set in PG2))
PG2: edit STATUS with just 2 buttons(Cancel, and Save)
Combine Pavel_p and my solution with each other. Then you have it your way.
As a best practice, I would recommend you to use a fetch function to load the status.
1. page 1 -> page 2 hand over the primary key
2. on P2 you make a load function that gives you the data of the primary key (status) so that you get the status of the record at the current time. (You have to save this in the dataset? then you have to add an update function or you will only get the one from the record as it is registered in the database)
3. SL with status if it is changed, transfer it to the px_edit_psj_condition
the rest is shown in the pattern applications of Pavel_p and mine.
So if I get your requirements right, you want to hide a button EDIT_PRJ_STATUS on page 1 based on the P2_STATUS LOV (if Closed => Hide, otherwise show). To do so, we need to return P2_STATUS item (see the UPDATE AND CLOSE DIALOG dynamic action on page 2, Close Dialog true action, Items to Return attribute). I created a helper item P1_STATUS_HELPER on Page 1 that is being set by the dialog returned item (see the set_status_helper DA, Set Type = Dialog Return Item). Now we just need to create another conditional DA on P1_STATUS_HELPER change event (see the show_hide_btn DA on Page 1).
Yes that is exaclty what i want,
This changes are made in your application ?