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 !

19 thoughts on “AJAX Computations – rich client feeling

  1. 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. 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

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

  4. 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

  5. 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.

  6. 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

  7. 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

  8. 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

  9. 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

  10. 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

  11. 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

  12. 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

Leave a Reply

Your email address will not be published. Required fields are marked *