Oracle form learning notes

Source: Internet
Author: User

Add form
Open the template, change it to the name you want, delete blockname and detailblock in data blacks, delete blockname in canvases, delete blockname in windows, and add your own windows, canvases, and dateblacks, in form-level PRE-FORM, change blockname to a new window. If org is distinguished, add fnd_org.choose_org; to the previous line of the block and open app_custom in program_unit, modify <your first WINDOW> as your own window, and add app_window.set_title ('<your window Name>',: parameter.org _ Code) to when_new_item_instance of triggers ), add Org to form title.
1. Add org_code to the form title
In the form-level when-New-form-instance trigger, add app_detail into set_title ('query _ Find ',: parameter.org _ code.
2. view the data source path of the elastic column: System Administrator --> Application --> flexfield --> descriptive --> segment
3. initialize View
Begin
Dbms_application_info.set_client_info (188 );
End;
For a view that requires user_id to be accessed, You need to initialize a valid user_id first.
Begin
Fnd_global.pai_initialize (26872,56536, 401 );
End;
4. Common Code
Fnd_message.debug ('show message'); -- display Prompt window
Raise form_trigger_failure; -- used with show message to interrupt form execution
Interface setting during form open/close
For example, write in close_window to control the multi-window form to switch back to the block When closing the sub-window.
If (WND = 'query _ Find ') then -- when the window query_find is closed
App_window.close_first_window; -- close the first window, that is, close this window.
Elsif (WND = 'approver _ Update') then -- when the window of approve_update is closed
Go_block ('query _ Find '); -- go_block goes to the query_find block.
End if;

Write the following code under open_window to control how to open a new window.
If (WND = 'Update _ user') then -- When window update_user is opened
App_window.set_window_position ('Update _ user', 'cascade ', 'approver _ Update'); -- set the window update_user to slightly lower in the upper left corner of the window of approver_update. For details, see the following description.
Set_window_property ('Update _ user', visible, property_true );
Go_block ('Update _ user'); -- specifies the block to be displayed.
Elsif (WND = 'ac') then
App_window.set_window_position ('act ', 'cascade', 'approver _ Update ');
Set_window_property ('act ', visible, property_true );
Go_block ('act ');
End if;

App_window.set_window_position
Procedure app_window.set_window_position (
Child_window varchar2,
Style varchar2,
Parent_window varchar2 default null );
Description: displays the position of the subwindow.
Parameter: name of the child form at the specified position of child_window
Positioning type of the style subwindow
Name of the upper-level window of the parent_window subwindow
Style: cascade multiple windows are arranged from top left to bottom right
Right and below subwindows are on the right or bottom of the parent window, and the parent window does not overwrite the Child Window.
Overlap the Child Window overlaps with the parent window, alignment to the left of the parent window, but shift 0.3 downward
The center subwindow is displayed in the middle of the parent window.
First_window is displayed below the toolbar, usually the main window

When processing a query, if the query interface bar does not meet the condition, it indicates that this column is null.
Method: make a judgment under the trigger of the KEY-EXEQRY under the block that shows the record, and then assign the final where condition to the default_where of the block. The Code is as follows:
Declare
V_default_where varchar2 (400); -- defines the initial where condition for storing the block.
V_where varchar2 (2000); -- defines variables used to store new where conditions
Begin
V_default_where: = get_block_property (: system. cursor_block, default_where); -- Obtain the initial where condition of the block.
V_where: = v_default_where; -- assign the initial where condition to the variable v_where.
If v_default_where is null then -- when the initial condition is null, you do not need to add 'where', 'and' or the like to the condition.
If: query_find.emp_class_code is null then -- if the column on the query interface is empty
V_where: = v_where | 'emp_class_code is null'; -- add the query condition to the column where it is null.
Else
V_where: = v_where | 'emp_class_code = '|: query_find.emp_class_code; -- use an SQL query statement with a column value equal to the column value in the query interface
End if;
Else -- add 'and' when the initial condition is not empty and the query condition is queried'
If: query_find.emp_class_code is null then
V_where: = v_where | 'and emp_class_code is null ';
Else
V_where: = v_where | 'and emp_class_code =' |: query_find.emp_class_code;
End if;
End if;
Set_block_property (: system. cursor_block, default_where, v_where); -- assign a new query condition to default_where of the block for query.
Clear_record;/* clear; otherwise, the form will bring the previous condition into the next query */
Execute_query; -- execute the query command
Set_block_property (: system. cursor_block, default_where, v_default_where); -- restore the original default default_where Value
End;

Cancel lov Verification
Set_record_property (: system. trigger_record,: system. trigger_block, status, query_status );
The field values commonly used on the Interface come from select .... into... this field is bound to the lov field to prevent the interface from entering the query mode. If no operation is performed, it needs to be saved. Alternatively, the column on the interface only records the ID in the table, when searching with name, use the Select name into field directly.

Set column attribute values
App_item_property.set_property ('Act. new_act ', required, property_true );
Field of act. new_act Block
Required attribute name
Property_true Attribute Value

Trigger that calls Block
App_record.for_all_records ('act _ list', 'select _ count ');
Act_list block name
Select_count trigger name
5. When a window has multiple canvases, a canvas is usually not displayed. This method is available.
Show_view ('canvas ') command, where canvas is the name of the canvas to be displayed.
Note: When show_view is used to display the canvas, the focus will return to the previous canvas, so that there will be no problem in show canvas_stacked, however, when the new window is displayed, the window to be displayed will flash and run behind the previous window. To solve this problem, you can call
App_custom.open_window ('act _ list'); to show the window you want, where act_list is the block name.
6. The Yes or No dialog box is displayed.
Fnd_message.set_string? ');
V_ques_no: = fnd_message.question ('yes', 'no', null );
If v_ques_no = 1 then
Del_lines (p_head_id );
Add_lines (p_head_id, p_organization_id );
Else
NULL;
End if;
7. click the button to clear the next interface value to be displayed.
Go_block ('<blockname> ');
Clear_block (no_validate );
8. fnd_standard.set_who; insert the creator, create a date, last updated by, last updated by, Last logged on by, and other information
9. Clear the data in the block
App_find.clear; clears the value of the current block. Other blocks cannot be cleared using the go_block ('<blockname>'); method.
App_find.clear_detail ('<blockname>'); clears the value of the specified block.

Related Article

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.