3 Replies Latest reply on Nov 2, 2009 9:21 AM by ATD

    APEX Shortcuts using PL/SQL Function Body source

      Hi All,

      I recently came across the functionality of "Shortcuts" in the "Shared Components" section of APEX and thought great, somewhere to define common/standard elements once, and then use these multiple times within various pages of my application.

      This seemed to work fine when using the "Source Type" of either 'HTML Text' or 'HTML Text with escaped special chars', but then I wanted to explore the use of the 'PL/SQL Function Body' option to create a more dynamic shortcut/variable based on input.

      This is where I have come across a peculiar problem in APEX (Version on 11gR2 on Oracle Enterprise Linux). When I define my shortcut, and then place a reference to my shortcut (using "MY_SHORTCUT") within a region of a page, the shortcut value is return, but is appended with the reference variable as well (ie. the string "MY_SHORTCUT").

      For simplicity, my example looks like this (of course my real world example is a little more intricate, but this example generates the same error):
      a) I define my shortcut called "MY_SHORTCUT", and using the PL/SQL Function Body option under 'Source Type', define my procedure as 'htp.p(:USER);' .
      b) I then create a new page (the basic HTML page), and a new region of the 'type' -> "HTML Text (with shortcuts)".
      c) In the 'Region Source' I define my shortcut as - "MY_SHORTCUT".
      d) I then apply the changes, and then run the page.

      What I get back will be the current user's name with "MY_SHORTCUT" concatenated/appended immediately after the user's name - eg. the string:- 'BRAD "MY_SHORTCUT"'.

      Question is - How do you stop the Shortcut reference/text "MY_SHORTCUT" from being appended onto the variable you wish to show and subsequently appearing on your page? I'm just wanting the variable, NOT the reference to the Shortcut.  Am I doing something wrong by using the HTP package, and if so, what should I use?

      If "MY_SHORTCUT" is defined as 'HTML Text with escaped special chars' (where I can reference application items using the syntax '&USER.') then everything works fine. My reason for using PL/SQL is to generate a more dynamic output variable, based on application items throughout the whole app - and obviously using Shortcuts to minimise coding and duplication.

      Thanks in advance,