9 Replies Latest reply: Feb 13, 2014 7:30 AM by siegwin.port RSS

create dynamic help based on sql statement

siegwin.port Newbie
Currently Being Moderated

Hi,

a few years ago I asked the same question but I got no suitable answer for my problem:

I have to build a dynamic help text for diaplayed items (bubble help or better popup window). When I go to an Item Header there is a ? displayed and when I click on the left mouse button there will be a constant text displayed. Now I have a table with explanation (build on the documentation of the table) for each column on each page. So I want to start a SQL-Statement when I click the button and the text should be displayed in the popup window.

Is there an example anywhere or can anybody help me otherways?

Regards

Siegwin

  • 1. Re: create dynamic help based on sql statement
    VC Guru
    Currently Being Moderated

    It can be easily done using ajax api's OR dynamic actions.

     

    Here is an very old example but I would not recommend you to follow this - but this will give you an better idea Using AJAX in Your Application

     

    The latest doc is JavaScript APIs

  • 2. Re: create dynamic help based on sql statement
    siegwin.port Newbie
    Currently Being Moderated

    Hi,

    I am not familiar with AJAX and ajax apis.

    If I put my mouse over the label of a column like "Name" for column ename and click on this label can I activate a dynamic action? Must I build a dynamic action on the region? And what is there to do? How can I know on which label is the click?

    Please help me again

  • 3. Re: create dynamic help based on sql statement
    Danny*D201 Journeyer
    Currently Being Moderated

    Here's an old post, but still works, https://community.oracle.com/message/1464878#1464878

    this solution requires no ajax, but you must create a shadow item for each item to hold the value of the help text, and populate the shadow item with a sql when page loads.

     

    ajax solution will require a few things

    1, Create an application item called "dynamic_help_text" for example.

     

    2, Let's say, for a textfield P1_TEXT, set header to have a onclick call to pass in a variable,

       e,g, lable -- <span onclick="onclick="getItemHelpText('#CURRENT_ITEM_NAME#');">test</span>

       Can also use #CURRENT_ITEM_ID# if you want, the #CURRENT_ITEM_NAME# should be unique in apex app any way and more readable..

     

    3, create javascript function in page defination (or Page 0 if you need it across the multiple pages) to execute on demand process

    function getItemHelpText(itemName){

       var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getItemHelpText',&APP_PAGE_ID.);

       get.addParam('x01',itemName);

       get.get();

       get = null;

    }

     

    4. create on demand process in shared components, named "getItemHelpText" to get the help text for this item and assign the value to application item.

    -- replace this query with your real dynamic query put apex_application.g_x01 into where condition

    -- e.g -- select help_text from custom_table into :dynamic_help_text where item_name = apex_application.g_x01;

    select 'help text: '||apex_application.g_x01 into :dynamic_help_text from dual where 1=1;

     

    5, in help text section of the item put &dynamic_help_text.

     

    6, run the page, make sure the item has an template 'Optional lable with help' or 'Required lable with help', click on the labl after page loaded, the results for this example should be help text in a popup window says "help text: P1_TEXT"

     

    There, you have a dynamic help text for P1_TEXT based on dynamic sql result from step 4.

    Modify the Ajax interface and on demand process steps 3&4 to handle more parameters if you need more complex query to work our the help text. hope not, how complex help text has to be ... hahaha..

  • 4. Re: create dynamic help based on sql statement
    siegwin.port Newbie
    Currently Being Moderated

    Hi,

    thank you for your good answer but where should I put

    <span onclick="onclick="getItemHelpText('#CURRENT_ITEM_NAME#');">test</span>

    I mad a demo application with your solution without specifying a special help, only to test the result. If you want to have a look on it

    http://apex.oracle.com/pls/apex/f?p=4550:1:0:::::

    Workspase pos_schulung

    Appliaction

     

    APEX Teil 2

    10690

    User demo/demo

    start with page 40, select one and use P41_ENAME as test object.

     

    Please help me again!

    Thank you very much

    Siegwin

  • 5. Re: create dynamic help based on sql statement
    Danny*D201 Journeyer
    Currently Being Moderated

    eidt P41_ENAME

    in the label field put <span onclick="getItemHelpText('#CURRENT_ITEM_NAME#');">Employ Name</span>
    i can't edit it for you as a guest user in your app.

     

    if you are using dynamic help text on lots of items, better put the onclick call in the template, and the function on page0

     

    e,g update Optional Label with Help template before label field to

     

    <label for="#CURRENT_ITEM_NAME#"><span class="t9optionalwithhelp" onclick="getItemHelpText('#CURRENT_ITEM_NAME#')"><a href="javascript:popupFieldHelp('#CURRENT_ITEM_ID#','&SESSION.')" tabindex="999">

  • 6. Re: create dynamic help based on sql statement
    siegwin.port Newbie
    Currently Being Moderated

    Hi,

    please do so and edit it as demo/demo

    Thank you

    Siegwin

  • 7. Re: create dynamic help based on sql statement
    siegwin.port Newbie
    Currently Being Moderated

    Hi,

    I copied this solution into the label field of P41_ENAME. Now I lost the label and a Help doesn't work.

    What did I wrong?

    Regards

    Siegwin

  • 8. Re: create dynamic help based on sql statement
    Danny*D201 Journeyer
    Currently Being Moderated

    fixed for you, changes are:

    1. added onclick="getItemHelpText('#CURRENT_ITEM_NAME#'); call to your 'Optional With Help' template, so all items use this template will have the same call in it.
    2. added global page, page 0,
    3. moved javascript "getItemHelpText" onto page 0 to become a global function, so you can use it anywhere in the app
    4. added globle item P0_DYNAMIC_HELP_TEXT in page 0
    5. updated your application process to set the P0_DYNAMIC_HELP_TEXT value upon AJAX call, you need to fix the help text.
    6. changed help text for P41_ENAME to &P0_DYNAMIC_HELP_TEXT.

    that's all I think, tested worked.

    good luck with the rest..

  • 9. Re: create dynamic help based on sql statement
    siegwin.port Newbie
    Currently Being Moderated

    Htank you very much!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points