[Form Builder] The difference between POST and Commit_form

Source: Internet
Author: User

commit_form: The data on the form is written to the database, and will be submitted in the databases, that is, the Direct query table is able to find the results, in the lower left corner of the form will be "frm-40400:transaction Complete:4 Records applied an saved "

Post: The data on the form is written to the database, but it is not submitted, that is, the direct query table is not found in the record, in the lower left corner of the form will be "frm-40404:database apply Complete:4 Records applied "

Recently encountered a form requirement, you need to insert the last record of the operation into the history table during the form operation (insert the temporary table first, and finally insert the record that satisfies the requirement into the history table),

For example: When you enter TRX Quantity, you may have entered 1--->0.001,2--->0.002,3--->0.003,4--->0.005,

But finally changed to the data, the requirement is that the last data on the screen into the Operation record table (first insert the temporary table, finally the record of satisfying the request to insert the Operation record table), other data can not be inserted, and because this form every time when entering this block "Trx Oper Quantity" The data is blank (this requirement description cannot use the regular detail block logic because the detail block logic is able to query the value from the database every time the record is entered), but the value of "OPR ID" is derived from the other table, namely: the first entry into this block (: system.record_status= ' New ') will require that each operation ID be entered into a fresh TRX quantity and then returned by the "Back" button to return the Trx Quantity value, and enter later (:system.record_status<> ' new ' ) shows the value that the current session has entered

The Details "when-button-press" logic code is as follows:

IF:system.record_status = ' NEW ' then---the first entry into "Transfer out details" to insert data into a temporary table
Delete from xxwip_mucl_transfer_details WHERE 1=1;----Remove data from temporary tables first

INSERT into Xxwip_mucl_transfer_details---
(Transaction_date,
ORGANIZATION_ID,
INVENTORY_ITEM_ID,

OPERATION_ID,
Trx_oper_quantity
)
VALUES
(: Transfer_header.transaction_date,
: transfer_lines_f.organization_id,
: transfer_lines_f.inventory_item_id,

A.operation_code,----values from other table
0---

);
End Loop;
END IF;

The back "when-button-pressed" code is as follows:

Declare

Ln_operation_quantity_r number;

Begin

Ln_operation_quantity_r: = 0;

First_record;

Loop

Ln_operation_quantity_r: = ln_operation_quantity_r+ NVL (: Transfer_details. trx_oper_quantity,0);

EXIT WHEN:system.last_record = ' TRUE ';

Next_record;

End Loop;

Post; ----Press the Back button to submit data to a temporary table, the data on the form is written to the database, but is not submitted, that is, the Direct query table can not find the record, in the lower left corner of the form will be "frm-40404:database apply Complete:4 Records applied "

---: system.message_level: = 25;

---commit_form; --- writes the data on the form to the database, and it is submitted in databases, that is, the Direct query table is able to find the results, in the lower left corner of the form will get "Frm-40400:transaction Complete:4 Records Applied an saved "

---: system.message_level: = 0;

If Ln_operation_quantity_r >: transfer_lines_f.available Then

Fnd_message.set_string (' Available quantity is not Engouh for transaction ');

Fnd_message.show; Fnd_message.error;

RAISE form_trigger_failure; End If;

If Ln_operation_quantity_r > 0 Then

Copy (Ln_operation_quantity_r, ' transfer_lines_f.transfer_out ');

Copy (' Y ', ' transfer_lines_f.check_box ');

---ln_operation_quantity_r: = null;

End If;

Go_block (' Transfer_lines_f ');

Hide_window (' transfer_details ');

End

Description

Writes data in the form to the database, but does not perform a database commit. Oracle Forms first validates the form. If There is changes to post to the database, for each block in the form Oracle Forms writes deletes, inserts, and updates to the database.

Any data so you post to the database are committed to the database by the next commit_form that executes during the Curre NT Runform session. Alternatively, this data can is rolled back by the next clear_form.

Syntax

PROCEDURE POST;

Built-in Type restricted procedure

Enter Query Mode No

Parameters

None

Usage Notes

If This form is called via Open_form with the no_session parameter specified, then the POST would validate and write the D ATA both in this form and in the calling form.

POST Examples

/*** Built-in:post and Exit_form

* * Example:leave the called form, without rolling back the

* * Posted changes so they could be posted and

* * Committed by the calling form as part of the

* * Same transaction.

*/

BEGIN

Post;

/*

* * Form_status should is ' QUERY ' if all records were

* * successfully posted.

*/

IF:System.Form_Status <> ' QUERY ' then

Message (' An error prevented the system from posting changes ');

RAISE form_trigger_failure;

END IF;

/*

* * By default, Exit_form asks to commit and performs a

* * rollback to savepoint. We ' ve already posted, so we do

* * need to commit, and we don ' t want the posted changes

* * To is rolled back.

*/

Exit_form (No_commit, no_rollback);

END;

[Form Builder] The difference between POST and Commit_form

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.