Friday, October 28, 2016

Create custom form with folder functionality Oracle forms



      1)      Open APPSTAND.fmb and copy STANDARD_FOLDER object group to the form.

      2)      Add the library APPFLDR.pll to the form.

      3)      Create a parameter of type number with initial value as 2. Parameter name should be    
               blockname_parameter. Create more blockname_parameters if the form has more folders.

Tip: Use Tabbed canvas Tab Pages to place/align the FIXED and STACKED canvases for visual appeal.


Canvas

        1)      Create a Primary content canvas for Window and 2 stacked canvas. 1 as NAME_FIXED and
            as NAME_STACKED. Set window to primary window.

a.       Set NAME_FIXED subclass as CANVAS_STACKED_FIXED_FIELD and add the primary fields from data block. (usually less than 4 non editable fields but can be many)

b.      Set NAME_STACKED subclass as CANVAS_STACKED and add all the needed fields from data block.

Block Level 

         1)      Set main data block item property Prompt to null which are used on canvas. Headings are  
                  used from prompt block mentioned below.
                           


              2)       Create FOLDER_SWITCH item on main data block with subclass property ‘Switcher’. 

                             


            3)      (Optional) CURRENT_RECORD_INDICATOR on main data block with subclass property
               CURRENT_RECORD_INDICATOR

                     
                          


         4)      Create the following 9 Triggers at Main Data Block Level  

              
    WHEN-NEW-BLOCK-INSTANCE
                 app_folder.event('WHEN-NEW-BLOCK-INSTANCE');
KEY-PREV-ITEM
               if (:parameter. blockname_parameter = 1) then
                     previous_item;
                    else
                          app_folder.event('KEY-PREV-ITEM');
                   end if;
KEY-NEXT-ITEM
               if (:parameter. blockname_parameter = 1) then
                     next_item;
                    else
                          app_folder.event('KEY-NEXT-ITEM');
                   end if;
PRE-BLOCK
           app_folder.event(‘PRE-BLOCK’);
KEY-EXEQRY
            app_folder.event(‘KEY-EXEQRY’);
POST-BLOCK
               app_folder.event(‘POST-BLOCK’);
PRE-QUERY
             app_folder.event(‘PRE-QUERY’);
POST-QUERY
             app_folder.event(‘POST-QUERY’); 


Create Prompt Block

Once the main data block item properties are set, copy items that are displayed on canvas and create a new prompt block. Don’t use FOLDER_SWITCHER and CURRENT_RECORD_INDICATOR items from main data block.

            1)      Set subclass of the prompt block to DYNAMIC_PROMPT.


2)      Set subclass of the item as below and assign items to appropriate canvas (Fixed/Stacked).

Item Type: Display Item

Subclass: FOLDER_PROMPT_MULTIROW

Initial Value: Prompt of the field name


            3)      Add the following items to the prompt block


Properties

FOLDER_OPEN

Item Type: Push Button

Subclass: FOLDER_OPEN

Canvas: Content Canvas / Tabbed canvas as per design

FOLDER_DUMMY

        Item Type: Text Item

Subclass: FOLDER_DUMMY

Canvas: TOOLBAR

FOLDER_TITLE

Item Type: Display Item

Subclass: DYNAMIC_TITLE

Canvas: Content Canvas / Tabbed canvas as per design

ORDER_BY1

Item type: Push Button

Subclass: FOLDER_ORDERBY

Canvas: Content/Fixed/Stacked Canvas

ORDER_BY2

Item type: Push Button

Subclass: FOLDER_ORDERBY

Canvas: Content/Fixed/Stacked Canvas

ORDER_BY3

Item type: Push Button

Subclass: FOLDER_ORDERBY

Canvas: Content/Fixed/Stacked Canvas



Form level triggers

1)      WHEN-NEW-FORM-INSTANCE
               APP_FOLDER.DEFINE_FOLDER_BLOCK(

                                  object_name        => 'XXXX' --NAME OF WINDOW

                                , folder_block_name  => 'XXXX'  --'FOLDER_BLOCK'

                                , prompt_block_name  => 'XXXX'              --'PROMPT_BLOCK'

                                , folder_canvas_name => 'XXXX' --'STACKED_CANVAS'

                                , folder_window_name => 'XXXXX'         --'WINDOW'

                                , disabled_functions =>  null       -'UPPER, ENABLED, lower, disabled'

                                , tab_canvas_name    => 'XXXXX'  -- TAB CANVAS

                                , fixed_canvas_name  => 'XXXX' --'STACKED_CANVAS_FIXED ) ;
                        app_folder.event( 'INSTANTIATE' ) ;
show_view('XXXX') ; --'STACKED_CANVAS'

2)      FOLDER_ACTION
                        app_folder.event(:global.folder_action);

3)      FOLDER-RETURN-ACTION (OPTIONAL)

If (:global.folder_action ='CONFIRM-HIDE-FIELD') then

                If :global.folder_field in ('FIELD1','FIELD2',etc..) then

                                :global.folder_action_allowed := 'FALSE';

                End if;

End if;

4)      WHEN-WINDOW-RESIZED

                                If :system.event_window in ('PO_REQ_INTERFACE_ALL_WINDOW') then

                                                app_folder.event('WHEN-WINDOW-RESIZED');

                                End if;