Reputation: 23
I'm using Application Express to build a page with a form that shows all the rows in Table A
. Table A
has to contain all the values from Table B
that have a specific "Status".
I'm looking for a way to update Table A
so that new rows with the correct status from Table B
are added to Table A
.
Is there a way to add a button
to the page that inserts into Table A
those rows? I have no problems with coding the query itself, but on Apex' Page Designer, when I add a button
(which I called Refresh
) to the page, I can't find a place to add the Insert Query.
Any tips?
Upvotes: 2
Views: 8683
Reputation: 1900
there are several ways to do what you need, the simplest one would be to bind a dynamic action to the click event on the button.
On the button definition go to "Action when button clicked" region and on the action field select "Defined by dynamic action"
On execute validations choose "No"
Then, back on the page definition, create a dynamic action, on Event choose "Click", on Selection type choose "Button" this will make a field named button appear whit a list of the available buttons to choose. In condition you can define a true/false evaluation. if so then you would be able to define actions to execute in both cases, if you leave it empty ("No condition") then all the actions defined will be executed.
Once defined click next and here you decide the action type, the one you need is "Execute PL/SQL Code", which will show a text field on which you can paste your code, and the parameters needed from the page.
finally you can specify if the action will have a repercussion on any kind of visual component on the page, this is for efficiency, but is not necessary.
That would be all, once created, when you click the button the code will be executed on the server.
Upvotes: 4