AJAX Computations – rich client feeling

Ever got a customer request saying: “When i enter a number in this field i want to display the corresponding name over there as soon as i leave the field” ?

That’s the point where you tell your customer something about using a LOV instead or reloading the page or something else, because APEX lacks declarative AJAX functionality.

No Problem anymore, now you can use the new ApexLib Feature “AJAX Computations” which basically is a standard Computation for a page item with a new ApexLib Property “AJAX Computation”.

Check it out over here.

Seen it? Good, hope you like it. Here is what you need to do:

  • declare a page item P70_EMPLOYEE_ID where user enters his number
  • declare a page item P70_NAME where the corresponding name should be displayed
  • declare a computation for page item P70_NAME, Type SQL Query: SELECT FIRST_NAME||’ ‘||LAST_NAME FROM EMPLOYEES WHERE EMPLOYEE_ID=:P70_EMPLOYEE_ID
  • now go back to your computation and set the “Ajax Computation” checkbox in the Apexlib-Section (appears only if you use the BuilderPlugin , if you can’t or don’t want to use the BuilderPlugin write $APEXLIB_AJAX_COMPUTATION$ in the comment field)

ApexLib converts this checkbox at runtime to an AJAX Call which executes the computation whenever a reference page item is changed and writes the result to the page item.

You see, it is very easy to use, so use it and impress your customers or your boss !



  1. Tim Gaul on November 9, 2009

    Nice. I was just wonder whether Apexlib would be able to handle AJAX computations, and BAM! this comes out a week before.

    Thank you, thank you, thank you Patrick! This will save a lot of pain and toil!

  2. Peter Raganitsch on November 9, 2009

    Hi Tim,

    i’m glad you like the new features.

    Peter

  3. Tim Gaul on November 9, 2009

    Hi Peter!

    I noticed that you’re working on the ApexLib project as well. So thanks to you too, we’ve been wondering when a new release would become available.

    I’m am afraid I have already hit my first snag. I’m am choosing a specified period from a select list, which is a pre-defined LOV. The value should then select the appropriate start and end dates (stored as DATE) and populate two date fields on the form. Unfortunately when I select from the drop down I receive the following error:

    Error: ORA-20555: Unsupported computation type “QUERY”!-

    My query on the Page Computation is as follows:

    SELECT t1.season_start_date
    FROM prs_season t1
    WHERE t1.id = :P580_SEASON

    Are there certain restrictions on the AJAX computations that I am not aware of, or have I missed something crucial?

    Thanks!

    Tim

  4. Tim Gaul on November 9, 2009

    Fix: edit ApexLib_Computation.pkb and change line 305, it should read ‘QUERY’ instead of ‘SQL QUERY’.

  5. Peter Raganitsch on November 9, 2009

    Hi Tim & everyone else,

    i implemented the fix (correction in APEXLIB_V_PAGE_COMPUTATION View and ApexLib_Computation.pkb Package) and uploaded a new zip-file ApexLib_v2_0_1.zip .

    All you have to do is install the database part of ApexLib again and computations will work regardless if you installed in own apexlib schema or in application schema.

    enjoy,
    Peter

  6. Tim Gaul on November 9, 2009

    Thanks Peter!

  7. Aleksandr Polivany on November 24, 2009

    Hi, Peter!

    Fix for ApexLib 2.0.1: change line 743 in ApexLib_views_for_apex_tables.sql, line 755 in ApexLib_views_for_apex_views_30.sql and line 772 in ApexLib_views_for_apex_views_22.sql.

    It is:

    , ‘$APEXLIB_AJAX_COMPUTATION$ ‘

    It must be (without trailing space):

    , ‘$APEXLIB_AJAX_COMPUTATION$’

    Thanks for your work!

    Alex.

  8. Blackstone on November 28, 2009

    Hi Peter,

    In the ApexLib_integrate_into_application.sql and the manual step by step instructions the entry into the page_footer_text of the popup lov template is:

    but this js file is not copied to the images folder in the oracle xe webdav installation instructions, should this be

    Also…

    On the website instructions for the automated integration it states:

    connect to the database using your Application Schema or user SYS
    and execute @ApexLib_integrate_into_application.sql

    It didn’t work with the user SYS.

    I’m just a beginner, so forgive me if I am completly wrong.

    Regards,

    Blackstone

  9. Blackstone on November 28, 2009

    Hi Peter,

    That didn’t come out too well, I’ll try again.

    In the ApexLib_integrate_into_application.sql and the manual step by step instructions the entry into the page_footer_text of the popup lov template is:

    src=”#IMAGE_PREFIX#apexlib_2_0/ApexLib_Lov.js”

    but this js file is not copied to the images folder in the oracle xe webdav installation instructions, should this be

    src=”#IMAGE_PREFIX#apexlib_2_0/ApexLib_Lov-min.js”

    Regards,

    Blackstone

  10. Blackstone on November 28, 2009

    Hi again,

    I have installed Apexlib with the ApexLib_integrate_into_application.sql. Browser validation is turned off by default, however I could not find any documentation on how to enable it. I hunted through the manual process and came accross it by accident by opening all the application items, process, regions, etc in my application. In the manual installation it is turned on by default. I am a novice but it would be nice if it was turned on by default as I have spent all day just trying to find this:

    ApexLib_Browser.initValidation
    ( pShowRequiredWarning => TRUE
    );

    Regards,

    Blackstone

  11. Peter Raganitsch on November 28, 2009

    Hi Blackstone,

    i’ll fix the documentation regarding the ApexLib_Lov-min.js, integrating works only using your application parsing schema (this is already fixed in the newest documentation online).

    I’ll check the integration script for defaulting pShowRequiredWarning to TRUE.

    thanks,

    Peter

  12. Peter Raganitsch on November 29, 2009

    I uploaded a new zip containing some bug fixes mentioned by Aleksandr and Blackstone and others.

    You can find the zip file here: https://sourceforge.net/projects/apexlib/

  13. Tim Gaul on December 7, 2009

    Thanks Peter! All looking much better now.

  14. Dave Sykes on December 23, 2009

    Hi, I have this installed and am running the sample app in my environment here. Let me just say this looks real promising. On the ajax validations I edit the P70_EMAIL field on page 70 (of course) I get the APEXLIB Framework section but no reference to AJAX. I see the 3 processes on the page load but I can’t correlate the processes to the items that are AJAX populated. What am I missing. Here is a cut and paste of what I see in the APEXLIB framework section.

    ApexLib Framework Top
    Is Required Note: Required is also detected by Label Template and NOT NULL validation.
    Min Value Max Value
    Case restriction
    Resizeable Textarea
    Always refresh cascading Lov
    No cascading Lov
    Don’t set Lov null value to NULL
    Don’t validate item
    Don’t trim item

    Dave

  15. Peter Raganitsch on December 24, 2009

    Hi Dave,

    i assume you used ApexLib before and your Apex Builder Plugin uses old Files. Please check in the Apex Builder Plugin settings the path it reads config files from.

    Peter

  16. Gonzalo on December 29, 2009

    I ve the same problem that Dave has. I cannot see the computation checkbox. In the configuration setting of grease monkey i ve enabled all the checkboxes. This is the url prefix: http://builderplugin.oracleapex.info/config/1.9/

  17. Peter Raganitsch on December 30, 2009

    Please use either a local configuration with the latest files from BuilderPlugin AND ApexLib, or point your URL to: http://apexlib.oracleapex.info/v2.0/BuilderPlugin/

    Peter

  18. Nagaraju Pudur on May 5, 2010

    Hi Peter,
    Its really nice and important stuff for apex develpers. Is there any Translation applicaton published on oracle site.
    I am having big problem for converting english to arabic(with Right ot Left Alignment). English to Arabic done successfully but Right to Left is not comming.

    I am really greatfull if i got any adivise from you.

    Thank
    Nagaraju P

  19. Peter Raganitsch on May 5, 2010

    Hi Nagaraju,

    thanks, but this is a little off topic, i think we should focus answering your question in your oracle forums thread: http://forums.oracle.com/forums/thread.jspa?threadID=1067675&tstart=0

    Peter