advanced formpersonalization

Upload: hserus

Post on 30-May-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Advanced FormPersonalization

    1/23

    1-1 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Form Personalization

    Advanced Concepts

  • 8/14/2019 Advanced FormPersonalization

    2/23

    1-2 Copyright 2004, Oracle. All rights reserved.TCS Internal

    After completing this module, you should be able to dothe following:

    Work with GLOBAL variables

    Understand Oracle Forms Query-by-Example

    (QBE) mode

    Create Special menu entries

    Zoom to other functions

    Objectives

  • 8/14/2019 Advanced FormPersonalization

    3/23

    1-3 Copyright 2004, Oracle. All rights reserved.TCS Internal

    The viewlet Oracle Applications FormPersonalization Demonstration AdvancedConcepts shows many of the concepts included inthis module.

    Related Course Material

  • 8/14/2019 Advanced FormPersonalization

    4/23

    1-4 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Agenda

    Global Variables

    Query-by-Example (QBE) mode

    Special menu entries

    Zooming

  • 8/14/2019 Advanced FormPersonalization

    5/23

    1-5 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Form Personalizations allows you to

    fundamentally alterthe behaviorof theproduct that Oracle ships, and access any andall data. Therefore,

    This feature should only be made available to

    trusted users. Avoid building Personalizations on a production

    system.

    Form Personalizations should first be

    entered and thoroughly QAed on a testsystem before they are loaded to aproduction system

    WARNING!

  • 8/14/2019 Advanced FormPersonalization

    6/23

    1-6 Copyright 2004, Oracle. All rights reserved.TCS Internal

    GLOBAL variables are dynamically created at

    runtime They can hold up to 255 bytes

    They are visible across all forms that arecurrently running

    They are very useful for Form Personalizations!

    Allow you to establish a value once then re-use it

    Allow you to pass information betweenforms

    Global Variables

  • 8/14/2019 Advanced FormPersonalization

    7/231-7 Copyright 2004, Oracle. All rights reserved.TCS Internal

    2 Properties affect them:

    VALUE:

    Creates it if it does not exist

    Always sets the value

    INITIAL VALUE: Creates it if it does not exist, setting it to null

    Only sets the value if it is currently null

    Global Variables, continued

  • 8/14/2019 Advanced FormPersonalization

    8/231-8 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Name any you create starting with XX

    Prevent collisions with global variables that baseproduct code creates

    In Conditions and evaluated strings, refer tothem with :global.

    Example: ='Your password must have at least '||:global.xx_password_length||' characters.'

    References will produce an error if the variabledoes not exist yet

    Make sure they exist by first setting the INITIALVALUE property in a prior action or rule

    Remember, they are shared across all forms

    Global Variables, continued

  • 8/14/2019 Advanced FormPersonalization

    9/231-9 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Global Variables, continued

    Creates the global variable:global.xx_password_failures if it did not alreadyexist

    Sets its value to :global.xx_password_failures Because the example is self_referencing, a prior

    Action needs to have created it!

  • 8/14/2019 Advanced FormPersonalization

    10/231-10 Copyright 2004, Oracle. All rights reserved.TCS Internal

    QBE is a power-user mechanism to locate

    records, instead of Find Windows Normally invoked by selecting View > Query By

    Example > Enter from the pulldown menu

    The builtin DO_KEY with argument

    ENTER_QUERY will invoke this mode, for thecurrent block

    It is a mode

    Things operate differently, or are suspended, until

    you exit this mode by Running a query or selectingCancel

    Specifically, any actions after invoking the mode willnot be executed until the mode is exited

    QBE Mode

  • 8/14/2019 Advanced FormPersonalization

    11/231-11 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Trigger Events can fire in QBE mode, or not

    Set Fire in Enter-Query Mode as desired This will cause the Rule to execute in both QBE

    and normal mode

    It is very, very, very rare that you would want your

    rules to fire in this mode! Later well discuss one example where this could

    be used.

    QBE Mode, continued

  • 8/14/2019 Advanced FormPersonalization

    12/23

    1-12 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Embedded in every menu are 45 entries you

    can activate

    Special Menus

    Each has the name SPECIAL#

    SPECIAL1 though 15: under Tools

    SPECIAL16 though 30: under Reports SPECIAL31 though 45: under Actions

    Must be activated in a Rule based on theWHEN-NEW-FORM-INSTANCE event

  • 8/14/2019 Advanced FormPersonalization

    13/23

    1-13 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Special menus, continued

    Menu Entry: which entry you want to activate

    Menu Label: the text for the menu entry

    Render Line before menu: will draw a separator line above themenu entry

    Enabled In Block(s): the blocks for which the menu entry should beenabled.

    Leave blank to enable for all blocks.

    Icon Name: the name of an optional .ico file, which will render in thetoolbar

  • 8/14/2019 Advanced FormPersonalization

    14/23

    1-14 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Special menus, continued

    This action:

    Activates the Tools

    menu and creates

    the menu entry, for

    all blocks of the

    form:

  • 8/14/2019 Advanced FormPersonalization

    15/23

    1-15 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Special menus, continued

    But Special simply activates the menu entry

    At runtime, if the user selects it, it emits an eventname that matches the menu entry name

    For example, if you activate SPECIAL1, when theuser selects it the event SPECIAL1 will be sent

    You create a second rule that triggers off that eventand does what you want

    WARNING

    Base product code uses these menu entries too.Select an entry they do not use

    The Menu Entry list shows the current label ifthere is one; no label is an indication it is currentlyunused

  • 8/14/2019 Advanced FormPersonalization

    16/23

    1-16 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Zooming

    One of the most commonly requested

    enhancements: The ability to open a function, passing

    context from the current function

    For example, from the Purchase Orders

    form, open the Vendors form, and passthe vendor on the current PO to query itsdetails

    Special+Globals+QBE lets you define these

    yourself!

  • 8/14/2019 Advanced FormPersonalization

    17/23

    1-17 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Zooming: One Strategy Activate a Special menu

    In response to that menu (when selected by the user),

    Copy context, like primary key fields, into globals Use Conditions to test those values

    If they are not set yet, show an error message

    If they are set, Open the desired function

    In the target form, Create a rule that sets the initial value of those globals to null,

    to insure they exist

    Then test them: if they are not null,

    {this is where other strategies, discussed later, could be used}

    Invoke QBE mode on the appropriate block Copy the values into base table fields

    Execute the query

    Clear the globals

  • 8/14/2019 Advanced FormPersonalization

    18/23

    1-18 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Zooming: One Strategy, continued

    To open the desired function

    Create an Action of type Builtin, with the TypeFND_FUNCTION.EXECUTE

    This example would open the Responsibilitiesform (after first checking security):

  • 8/14/2019 Advanced FormPersonalization

    19/23

    1-19 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Rules in the target form

    Rule 1: Trigger Event: WHEN-NEW-FORM-INSTANCE

    Action: For one of the global variables being passed, set itsINITIAL VALUE property to null (empty)

    This makes sure the next rule will not fail when the form is

    opened standalone Rule 2:

    Trigger Event: WHEN-NEW-FORM-INSTANCE

    Condition: test if that global variable is not null

    Action 1: Builtin GO_BLOCK to the block you want to query Action 2: Builtin DO_KEY with ENTER_QUERY to invoke

    QBE

    Dont put more actions here - they will not fire!

    Zooming: One Strategy, continued

  • 8/14/2019 Advanced FormPersonalization

    20/23

    1-20 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Rules in the target form, continued

    Rule 3: Trigger Event: WHEN-NEW-RECORD-INSTANCE, for the

    block you are querying

    Condition: test if that global variable is not null

    Fire in Enter-Query mode checked

    Action 1+: set the VALUE of the appropriate fields to have thevalues of the globals you passed

    The Value is of the format =:global.

    Create an Action for each variable you need to process

    Action 2+: Set the VALUE of the globals to null (empty)

    This prevents future queries from re-running just this one

    Create an Action for each variable you need to process

    Action 3: Builtin DO_KEY with EXECUTE_QUERY to run thequery

    Zooming: One Strategy, continued

  • 8/14/2019 Advanced FormPersonalization

    21/23

    1-21 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Zooming: Other Strategies

    Each form in Oracle Applications has its unique quirks. Youmay discover other ways to force it to query:

    The target function may already accept the value(s) asan input parameter Use the Add Parameters button to see parameters

    associated with other functions on the same form

    Note that this will not reveal every parameter that a functiontakes, nor its intended usage

    Examining source code is the only way to know exactly howparameters work

    Oracle does not warrant that a parameter will exist or functionthe same after a patch

    In forms that have Find Windows, it may be possible topopulate the appropriate field(s) in the Find window,then issue builtin DO_KEY with argumentNEXT_BLOCK

  • 8/14/2019 Advanced FormPersonalization

    22/23

    1-22 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Zooming: Other Strategies, continued You could modify the DEFAULT_WHERE clause of the

    appropriate block, then query it using DO_KEY with

    argument EXECUTE_QUERY, then reset theDEFAULT_WHERE clause back to its original value

    A little bit of experimentation and creativity is all it takes!

    Zooms need to be extensively tested after a patchbecause of their inherent complexity

  • 8/14/2019 Advanced FormPersonalization

    23/23

    1-23 Copyright 2004, Oracle. All rights reserved.TCS Internal

    Summary

    In this module, you should have learned how to:

    Work with GLOBAL variables, including the differecnesbetween the properties VALUE and INITIAL VALUE

    Understand Oracle Forms Query-by-Example (QBE) mode

    Create Special menu entries, and write Rules that respondto their selection

    Zoom to other functions, and various strategies to try