I m using forms 11g
I have one master-detail form.
I want to restrict the user from saving the non detail block record, If record entered in the corresponding master block has been rollbacked.
To be clear when i query or move out of that field i see a message 'do you want to save changes made?'
when i say 'NO', my master block values rolled back , but non detail block records are saving
I tried to use issue_rollback(null); but not working
Related
I have created sales master and sales detail (master/detail) relationship form.
I have entered record and saved it ...
Through another form, i hv updated few fields of sales_master table .. see below example
During data entry - Like ... Sal_OrdStatus = 'Open' and CashRcvd_Status='P'
Updating these fields through payment form Sal_OrdStatus = 'Closed' and CashRcvd_Status='R'
After this, when I am entering/execute those records where both fields are updated
then see below error even record is available in the database/table
frm-40301 query caused no records to be retrieved, re-enter
enter image description here
Please advise solution/ guideline
Thanks
Javed Akram
Querying data block won't return anything if there are no rows in the table at all, or if condition you set prevents any rows to be retrieved.
As some rows obviously exist (you updated them, not deleted), then it is the latter.
Use get_block_property built in and its last_query property (you can try default_where as well) to see which query was really executed; you'll see the where clause, and that should help you find the culprit. Once you know it, you'll be able to fix it.
I have an APEX form I'm developing for "user settings". I have a table with a sequence as a primary key and the users ID in another column...in addition to a few columns where each users saved settings are stored (things like "N" for do not receive notices).
I haven't used Oracle APEX in a while so excuse this likely newbie question...The insert works fine, but I'm having trouble with making the form only show the current users values. In my Form Region the source is set to my Table, and I have a WHERE clause like this:
USER_ID = 813309
But that's not working (813309 is my id and I'm just hard-coding it for now). The form always comes up with a "New" record.
For a form to load a specific record you can set the primary key page item to the value you need. You can do so in the url using the link builder from another page or you can set a computation on the item. That is what I would try in your case: add a computation to your item P_USER_ID of type "Static Value" with value 813309. Make sure the computation happens before the "Fetch Row" - the value obviously needs to be set before the process runs.
In such cases, I prefer creating a Report + Form combination (using the Wizard, of course): it creates an interactive report (so that you can review data in a table), and a form which is used to add new records or update/delete existing ones.
Doing so, when you pick a user in interactive report and click the icon at the beginning of a row, Apex redirects you to the form page, passing primary key column value to the form which then fetches appropriate data from the table.
Not that it won't work the way you're trying to do it, it's just simpler if you let Apex do everything for you.
So: did you create an automatic row fetch pre-rendering process? If not, do so because - without it - Apex doesn't know what to fetch. Also, if you hardcoded user_id, it won't do much good. Consider storing username into the table so that you could reference it via :APP_USER Apex variable.
I have oracle form which contains data block B_ITEM which refers database table master_item. The User is entering two items in one bill manually in data block and based on certain conditions I need to add freight item in same block B_ITEM automatically. could you please guide how to insert data in data block. (Note:I don't want to insert directly in table which it refers)
Step-1 Created a canvas on date block on B_ITEM where user can give provide input. Block
contains field item from master_item table.
Step-2 Lets Say, User entered two items on canvas which refers B_ITEM and click on ok button.
Step-3 So along with two items, one more item should get inserted in block B_ITEM and it should display on canvas on 3rd line.
In the above image, I have shown example of single item, so once user clicks on OK button 2nd item should get added based on setup table.
MASTER_FREIGHT_LINK
ITEM FREIGHT_ITEM
101396306 101396307
So, In canvas freight item should added on second row as soon as user click on OK button by entering ITEM-101396306.
I don't quite understand what you have, so - let me think aloud.
there's a table in the database, called MASTER_ITEM
you created a form whose block B_ITEM is based on the MASTER_ITEM table
data block contains some items which are, I presume, database items (that belong to the MASTER_ITEM table)
you enter some data into those items
based on their values (i.e. a certain condition), you'd want to populate FREIGHT_ITEM which resides in the same block, but is not a database item. Is that correct?
If that's so,
create the FREIGHT_ITEM (there are several ways to do that; a simple one is to use the vertical toolbar's + button; or, copy/paste one of existing items and modify its properties)
create WHEN-VALIDATE-ITEM trigger on items that should decide which value should be put into the FREIGHT_ITEM. Put the condition you mentioned into the trigger code and populate FREIGHT_ITEM's value, e.g.
if :b_item.item1 > 100 and
:b_item.item2 = 'A'
then
:b_item.freight_item := 42;
end if;
Now, as you said that you don't want to store that value into the database directly (which means that it is not a database item), you'll have to do it manually, creating additional ON-INSERT and/or PRE-INSERT and/or PRE-UPDATE trigger, which will do that as
update master_item i set
i.freight_item = :b_item.freight_item
where i.some_id = :b_item.some_id;
ON-INSERT trigger can be used to override oracle forms insert mechanism. Write in the on-insert trigger the insert statements necessary, which can insert data on any table.
I'm not an Oracle forms guy, but I'm stuck maintaining an old Oracle Forms 6i app that our company has, so I apologize if I sound like I don't really understand forms, because I don't.
We have a pre-existing form that I've had to make some change to. It has a master/detail type setup. There are a series of "rows" for the details. When I enter master info and the first detail record, I can save just fine. When I add a second row of info to the details section, it gets to the KEY-COMMIT trigger, but when it actually hits the "commit;" line, it gives me the error "Record has already been inserted."
But there is only the one record associated with the master details in the table. When I clear that message it asks, "Do you want to save the changes you have made?" If I click "Yes", it just gives me the "Record has already been inserted" message in the status bar and nothing happens. If I try to exit the form, it again asks if I want to save the changes, but "yes" does nothing but keep me on the form. Clicking "No" removes the second detail record.
I'm confused. I'm clearly missing something.
Your detail data block has the Enforce Primary Key property set to Yes. It means that rows inserted/updated/deleted by this block are not queried by rowid, but by primary key.
It does not matter, how is primary key set in database, but how is set in forms. Check all items in your detail block and find those with Primary Key (Item) property. Then check, if there is a duplicate record in database.
I prefer using rowid and uncheck Enforce Primary Key property. If your block works directly with database table (not view), it works fine
greetings,I'm facing a problem in Oracle Forms 10g. I created a simple master-detail form where i want to save data only from the detail data block (the master will function more as a browser).
The only solution found till now is to edit the properties of text items in the master block and prevent them from inserting/updating. This comes in conflict with the list of values (LOV) appearing when the user tries to input the app_id, or from a search button (i know that the way is not significant). Is there a way that i can pass values to the primary block and function only as a query?
Any help could save me from lots of trouble!
We can set various properties at the block level using the Block Properties palette. In your case you need to toggle off Delete Allowed, Insert Allowed and Update Allowed. Obviously you will want Query Allowed toggled on.