I use
open_from('b');
in WHEN-BUTTON-PRESSED trigger for open form B from form A.
how to close form A when I open form B by using WHEN-BUTTON-PRESSED in oracle form builder?
use new_form Built-in instead of open_form.
new_form will Exits the current form and enters the indicated form.
PROCEDURE NEW_FORM (
formmodule_name VARCHAR2,
rollback_mode NUMBER,
query_mode NUMBER,
data_mode NUMBER,
paramlist_name VARCHAR2);
Where:
formmodule_name
Then name of the called form (must be enclosed in single quotes). Datatype is VARCHAR2.
rollback_mode
TO_SAVEPOINT (The default.): Oracle Forms will roll back all uncommitted changes (including posted changes) to the current form’s savepoint.
NO_ROLLBACK: Oracle Forms will exit the current form without rolling back to a savepoint.
FULL_ROLLBACK: Oracle Forms rolls back all uncommitted changes (including posted changes) that were made during the current Runform session.
query_mode
NO_QUERY_ONLY (The default.) Runs the indicated form normally, allowing the end user to perform inserts, updates, and deletes in the form.
QUERY_ONLY Runs the indicated form in query-only mode; end users can query records, but cannot perform inserts, updates or deletes.
data_mode
NO_SHARE_LIBRARY_DATA (The default.): At runtime, Oracle Forms will not share data between forms that have identical libraries attached (at design time).
SHARE_LIBRARY_DATA: At runtime, Oracle Forms will share data between forms that have identical libraries attached (at design time).
paramlist_name
The name you gave the parameter list object when you defined it. Datatype is VARCHAR2.
simple example:
NEW_FORM ('FORM_NAME', full_rollback, query_only, no_share_library_data, p_id);
try this:
close_form('a');
open_form('b');
or
call_form('b');
By using call_form it will hide the form A and then display B and when user will exit from B then A will be active.
Related
I was wondering how does ORACLE APEX identify if a certain page item value should go as number or varchar2 when used in stored procedure call.
my_pkg.proc1(P1 =>:P2_ITEM1);
Here, how does APEX engine identify if the parameter P1 for proc1 is expecting a number or varchar2 or date.
To extend:
I have a grid. With query as below
Select * from table(my_pkg.pipe_func(:P2_PARAM1,:P2_PARAM2));
When user clicks a button I need to get the current session state value of these bind substitutions and I want to store above select query in a table as
Select * from table(my_pkg.pipe_func('ParamVal',256));
How can this be achieved?
It's the Oracle database that does this grunt work, in the same way it's done it for years. You can see this in the v$sqlarea.
And you should explicity convert these bind variables, as they will be inheretly treated as a varchar - same as they're stored.
where id = to_number(:p1_id)
And from an APEX perspective, if the user changes a value on screen, and you invoke a dynamic action to refresh a region using those items - you should list them in the 'Page items to submit' attribute, just under the region SQL. This will ensure the database session state is updated with what's in the browser, before conducting the refresh.
I have two blocks that are based on procedure and I want to create master-detail relationship between them.
I do this using Data Block Wizzard. It create trigger ON-CHECK-DELETE-MASTER, this trigger assumes that my detail block is based on table (FRL_XXX.TRIGGERS_QUERY, but it is a procedure) and generates cursor:
CURSOR TRIGGERS_cur IS
SELECT 1 FROM FRL_XXX.TRIGGERS_QUERY F
WHERE F.PTG_PST_CODE = :S_TYPES.PST_CODE;
Is there any workaround to solve this problem?
When I try delete this trigger or remove the cursor I get error:
FRM-30409: Delete Record Behavior for the relation is invalid.
I've never done that, but - let me think aloud.
If data block is based on a procedure, it means that procedure returns (as its IN OUT parameter) an array. I'd say that you'll have to
create your own trigger (i.e. replace the one created by the Wizard
note that these triggers usually have a comment "don't modify it!". If you run the Wizard again, it might overwrite your code, so safer approach is to create a procedure which will do the job, and call that procedure from the trigger
declare a local variable (array) and fetch data into it; pass all parameters to the procedure as you did while calling it in order to populate data block
review array's contents and check whether there's any row that satisfies condition PTG_PST_CODE = :S_TYPES.PST_CODE
if so, do what Wizard's trigger does in that case
Basically, I think that you'll have to write your own process which will replace default Forms behavior.
In Procedure based blocks, If you choose the Relation type as Isolated , Oracle form will allow the Master Detail relationship between two blocks because in that case ON-CHECK-DELETE-MASTER trigger won't be there.
You will be able to retrieve the records from detail block as ON-POPULATE-DETAILS trigger will work as-usual.
In my case, only detail block was based on Procedure and it's working fine.
Note : Isolated type of relationship will delete the master records even if child records exist. You need to handle this case separately.
Please share your approach step by step, if you went ahead as per littlefoot
Can anybody suggest a good trigger that I can use in a text box. The operation that i intend to use in the text box is when the user changes the value in the text box, I call a Procedure that updates that value in the Database table with a commit. However ,so the moment the user changes the value and presses enter it should go to the next item, before which it updates the DB. It works fine in the KEY-NEXT-ITEM trigger. However, one problem is that say the user changes the value in the fld , but does not press tab or enter, but directly F10 to commit. My trigger in the text box(i.e KEY-NEXT-ITEM) does not fire. I tried a POST-TEXT-ITEM , but it does not let me use the ,COMMIT or NEXT_ITEM built ins. I want the trigger to fire the moment the user exits the item and also it should go to the next item in the form
Use WHEN-VALIDATE-ITEM trigger. This trigger is basically intended to validate value entered by user. It fires every time when forms decided, that user finished field value - when user leaves field, when user presses commit, etc.
Unfortunately you are not able to use COMMIT_FORM in this trigger. Forms recommend make direct database changes in transactional triggers only. To implement database change with commit, make your database procedure running in autonomous transaction:
CREATE OR REPLACE PROCEDURE do_somethning (some_id NUMBER, some_value VARCHAR2) AS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
UPDATE some_table SET some_column = some_value
WHERE table_id = some_id;
COMMIT;
END do_somethning;
Yout WHEN-VALIDATE-ITEM trigger can be like this
BEGIN
-- probably do some validations
...
-- call your procedure
do_something(:some_block.id, :some_block.your_field);
END;
I have an Oracle Forms 6i application and there is a plsql batch and both are doing updates to the same table. There are fields that are directly mapped to table columns in a form of the Forms application. Whenever the form accessing the table is open, the plsql batch is blocked. How to create the form so that it does not block any other db sessions. Is there a way to load/create instance of the Form so that it does not hold any lock on the table?
You can try one of 2 possibilities:
1) For block there is property "Locking Mode" and one of it's values is "Delayed". Text from help:
Form Builder locks the row only while it posts the transaction to the database, not while the end user is editing the record. Form Builder prevents the commit action from processing if values of the fields in the block have changed when the user causes a commit action.
So if this value is set, then DB record will be locked only on update time.
2) Create ON-LOCK trigger for this block, with "Execution Hierarchy" property - "Override" (this is default one). And in trigger put code:
NULL;
In this case form's will not lock record and it will be done by DB only when necessary (after UPDATE statement is issued and till COMMIT or ROLLBACK is processed).
Forms locks the record only when a database-bound item is changed either by the user or by a trigger.
You probably have some WHEN-NEW-RECORD-INSTANCE or POST-CHANGE triggers that changes the values of database-bound items.
Before messing with locking modes, you should take a look on what causes forms to request a row lock. I bet you will be surprised!
Try first to disable ALL WHEN & POST trigger at Block & Item level, and examine if the form still locks the batch. After that start by enabling triggers until you spot the one that causes the problem.
I have your standard Oracle apex page to create / edit / delete a record.
I now wanted to call a stored proc when a new record is created (only on INSERT, not update/delete), so I created a Process on the page and tied it to the create button.
All is well so far....it calls the stored procedure as expected as verified by the debug messages I put in there. However, I wanted to pass the new PK created as part of the new record to the stored proc. However it is receiving null.
The process I created is set to run "On Submit - after Computations and Validations" which I think is right.
Can someone suggest why I might not be getting the new key? Is it still not available yet at that point in the form processing?
Any help appreciated.
If you are using a standard Apex "form on a table", then you can set the Return Key into Item property of the Process Row of ... process to specify a page item that will get populated with the PK of the inserted row:
You can then reference the item in your procedure call.