Detecting change to session state

Apex 4.0.2
Say I have a form page with a bunch of items. An On Load process populates them using SELECT...INTO. When the page is submitted, is there a way I can identify which page items have changed so they can be recorded in a database table. A generic solution instead of the brute-force way of duplicating all page items as hidden items and comparing values during processing.
When a page is run in debug mode, I see messages like Saving same value P1_FOO or when viewing session state using the Dev toolbar, there is a status column with Inserted or Updated so it would appear that the Apex engine does track changes to page items beteween the time they are rendered and processed.
Any ideas? Thanks

Tony & Jari - Yes, using collections would seem like the best option. It is not as difficult as I had imagined. Something like
apex_collection.create_or_truncate_collection('FORM_DATA');
for c1 in (select ... from apex_application_page_items
where application_id=:APP_ID and page_id=:APP_PAGE_ID and item_name in (...))
loop
  apex_collection.add_member('FORM_DATA',c1.item_name,v(c1.item_name));
end loop; can be used to populate the collection in a On Load process.
An After Submit process would compare v('item_name') to the corresponding value in the collection and do what it needs to do.
John - Thanks, that would work too I guess.
Thanks all

Similar Messages

  • ORA-29549: class hlpr_pdf_list_java has changed, Java session state cleared

    looks like this the simple program.... but i am getting that error
    SQL> create or replace and compile java source named "hlpr_pdf_list_java" as
    2 import java.io.*;
    3 import java.util.*;
    4 import java.util.zip.*;
    5 import java.text.*;
    6 import java.lang.*;
    7 import java.sql.*;
    8
    9 class hlpr_pdf_list_java
    10 {
    11 public static String hlpr_pdf_list_java(String dirname) throws Exception
    12 {
    13 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    14 Connection con = DriverManager.getConnection("jdbc:odbc:hlpr_dsn", "hlpr", "hlpr");
    15 Statement stmt = con.createStatement();
    16
    17 String retval=null;
    18 File dir = new File(dirname);
    19 String[] files = dir.list();
    20 if (files!=null)
    21 {
    22 for (int i=0;i<files.length;i++)
    23 {
    24 retval = files;
    25 stmt.executeUpdate("insert into hlpr_dir_list(dir_name,file_name) values(dirname,retval)");
    26 }
    27 }
    28 return retval;
    29 }
    30 }
    31 /
    Java created.
    SQL>
    SQL> CREATE OR REPLACE function hlpr_getfilesindir_fn(p_long_path_dir_name varchar2) return varchar2
    2 as language java name 'hlpr_pdf_list_java.hlpr_pdf_list_java(java.lang.String) return java.lang.String';
    3 /
    Function created.
    SQL>
    SQL> select hlpr_getfilesindir_fn('/d01/oradata/atlanta_gi/2007_10_1_12_31') from dual;
    select hlpr_getfilesindir_fn('/d01/oradata/atlanta_gi/2007_10_1_12_31') from dua
    l
    ERROR at line 1:
    ORA-29549: class HLPR.hlpr_pdf_list_java has changed, Java session state cleared
    SQL>
    any clues?

    Hi,
    Please from now own put this exact tag => (So that's: four characters, forming the word 'code' between curly brackets)
    before and after your examples. That way your indentation and formatting remains intact and we will be able to read and understand faster what's going on.
    ORA-29549: class HLPR.hlpr_pdf_list_java has changed, Java session state cleared
    any clues?
    Probably all you need to do is call your function once more or reconnect.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14219/e29250.htm#sthref8038
    +edit+
    Also let us know if you've got access to MetaLink/MyOracleSupport
    Edited by: hoek on Aug 24, 2009 9:23 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can I use my javascript to change the session state of an item?

    All,
    I currently have a page that has two regions: a report and a checkbox region. The checkbox region is full of checkboxes that are tied to each column in the report. I have javascript in the page HTML header that hides/displays the report column when they click the corresponding checkbox. The hiding and displaying columns works just fine.
    Here is my problem: my users need to export the report (with some columns hidden) as a CSV file. Unfortunately, the javascript function I use to hide/show the columns does not change the session value of the checkbox region and thus, APEX does not 'know' that some columns have been hidden. Because of this, APEX exports ALL columns.
    Can I add an onChange to my javascript that each time the user checks/unchecks a box, it adds/removes that item from the checkbox region's session value?
    Thanks!
    BoilerUP
    P.S. I do not want to submit the page - I would like for this to be done on the fly, just like the columns hiding/appearing with the javascript. Thanks!
    Message was edited by:
    BoilerUP

    Ok, I still cannot get this to work. I keep getting a javascript page error (yellow exclamation icon in I.E.) I have the following code in the HTML header:
    <script language="JavaScript" type="text/javascript">
    function va_GetCheckboxes(pName)
    var d=document;
    var l_return = "";
    var inputs=d.body.getElementsByTagName('INPUT');
    var l_el;
    for (var j=0;j<inputs.length;j++) {
         l_el = inputs[j];
         if (l_el.type=="checkbox" && l_el.name && l_el.name==pName
             && l_el.checked) {
                l_return += ":" + l_el.value;
    return l_return.substring(1);
    </script>I also have the following code in the HTML Form Element Attributes section for the checkbox item:
    onclick="html_HideBasedOnCheckBox(this,this.value);set_Some_Item('P2_COLUMN_HIDE_CHECKBOXES',that_string)"Do I need to replace "that_string" with something or is there something else that I'm doing wrong?

  • Trouble setting the session state of a select item.

    Hi,
    I have a requirement whereby I need to change the session state of a select list item in my form without the need to submit. I am using Application Express 4.1.0.00.32. I thought this would be straight forward using a dynamic action or javascript and calling an on demand process for example.
    P1_MY_SELECT onchange="set_option();"
    function set_option() {
    var l_option=$f_SelectValue('P1_MY_SELECT');
    alert( 'My new value is ' + l_option );
    // ON DEMAND Set the new session state value
    var lRequest = new apex.ajax.ondemand
    ('SET_P1_MY_SELECT',function()
    {  /* start the return function */
    var l_s = p.readyState;
    if(l_s == 1||l_s == 2||l_s == 3)
    else if(l_s == 4)
    { gReturn = p.responseText;
         (gReturn)?json_SetItems(gReturn):null;
    else{return false;}
    /* end the return function */
    lRequest.ajax.addParam('x01', l_option );
    lRequest._get()
    My on demand application process
    DECLARE
    l_options varchar2(2000) := wwv_flow.g_x01;
    BEGIN
    APEX_UTIL.SET_SESSION_STATE('P1_MY_SELECT',l_options);
    apex_util.json_from_items('P1_MY_SELECT');
    END;
    Is there a better method to set the session state of my P1_MY_SELECT other than what I am doing as above or can you tell me why the session state of P1_MY_SELECT is not changed?
    Thanks.
    Edited by: 968358 on 01-Nov-2012 08:40

    if you are on 4.1 why don't you use a dynamic action instead of writing the code again?
    create a dynamic action like this
    Event: Change
    Source Type: Item
    Item: P1_MY_SELECT
    True Action:
    =========
    Action: Execute Plsql Code
    Plsql Code: null;
    Page Items to Submit: P1_MY_SELECT
    Page Items to Return: P1_MY_SELECT (this is optional)
    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/advnc_dynamic_actions.htm#HTMDB27020

  • ORA-29550: Java session state cleared

    Hi all,
    I am using Oracle9i Enterprise Edition Release 9.2.0.6.0 on AIX
    I have created a job that executes daily at 00:00:00 and create files by selecting data from database. But job is breaking daily and subjected error found in alert log file.
    I have checked the metalink and found nothing except following
    Error:     ORA-29550
    Text:     Java session state cleared
    Cause:     The Java state in the current session became inconsistent and was
         cleared.
    Action:     No action required.
    Can anybody help me on this issue?
    Thanks,
    Hassan

    I am getting following errors when using forms. (Version is 11.5.10.2 on Linux)Are you using Forms 6i Builder?
    ORA-29549: class PUBLIC.NLS_SESSION_PARAMETERS has changed, Java session state cleared.
    oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-29550: Java session state cleared
    ORA-06512: at "APPS.XMLPARSERCOVER", line 6
    ORA-06512: at "APPS.XMLPARSER", line 175
    ORA-06512: at "APPS.IRC_XML_UTIL", line 110
    ORA-29549: class PUBLIC.NLS_SESSION_PARAMETERS has changed, Java session state cleared
    ORA-06512: at "APPS.IRC_APPROVALS", line 43
    ORA-06512: at "APPS.IRC_APPROVALS", line 179
    ORA-06512: at "APPS.IRC_APPROVALS", line 328
    ORA-06512: at "APPS.XXCIM_CANDIDATE_SEARCH_PKG", line 333
    ORA-06512: at line 1
    java.sql.SQLException: ORA-29550: Java session state cleared
    Any help would be really appreciated.Please see the solution in (ORA-29550: Java session state cleared encountered during execution of Generate function 'WF_XML.Generate' [ID 1368817.1]).
    Thanks,
    Hussein

  • ORA-29549: class PUBLIC.NLS_SESSION_PARAMETERS has changed, Java session.

    Hi,
    I am getting following errors when using forms. (Version is 11.5.10.2 on Linux)
    ORA-29549: class PUBLIC.NLS_SESSION_PARAMETERS has changed, Java session state cleared.
    oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-29550: Java session state cleared
    ORA-06512: at "APPS.XMLPARSERCOVER", line 6
    ORA-06512: at "APPS.XMLPARSER", line 175
    ORA-06512: at "APPS.IRC_XML_UTIL", line 110
    ORA-29549: class PUBLIC.NLS_SESSION_PARAMETERS has changed, Java session state cleared
    ORA-06512: at "APPS.IRC_APPROVALS", line 43
    ORA-06512: at "APPS.IRC_APPROVALS", line 179
    ORA-06512: at "APPS.IRC_APPROVALS", line 328
    ORA-06512: at "APPS.XXCIM_CANDIDATE_SEARCH_PKG", line 333
    ORA-06512: at line 1
    java.sql.SQLException: ORA-29550: Java session state cleared
    Any help would be really appreciated.
    Thanks in advance.

    I am getting following errors when using forms. (Version is 11.5.10.2 on Linux)Are you using Forms 6i Builder?
    ORA-29549: class PUBLIC.NLS_SESSION_PARAMETERS has changed, Java session state cleared.
    oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-29550: Java session state cleared
    ORA-06512: at "APPS.XMLPARSERCOVER", line 6
    ORA-06512: at "APPS.XMLPARSER", line 175
    ORA-06512: at "APPS.IRC_XML_UTIL", line 110
    ORA-29549: class PUBLIC.NLS_SESSION_PARAMETERS has changed, Java session state cleared
    ORA-06512: at "APPS.IRC_APPROVALS", line 43
    ORA-06512: at "APPS.IRC_APPROVALS", line 179
    ORA-06512: at "APPS.IRC_APPROVALS", line 328
    ORA-06512: at "APPS.XXCIM_CANDIDATE_SEARCH_PKG", line 333
    ORA-06512: at line 1
    java.sql.SQLException: ORA-29550: Java session state cleared
    Any help would be really appreciated.Please see the solution in (ORA-29550: Java session state cleared encountered during execution of Generate function 'WF_XML.Generate' [ID 1368817.1]).
    Thanks,
    Hussein

  • How to tell if a user is issuing 'alter session statements'

    When I run 'alter session' from sqlplus in my schema, this does not get parsed and go to v$sql or show up in v$open_cursor. I have a user that is running queries from informatica. He says he is passing alter session statements through informatica, I want to see if they actually get there. The person is not real versed in oracle and I don't know informatica.
    i cant turn on trace cause he connects and disconnects and this would run immediately, I am not in a position to turn on system level tracing, add a trigger, or turn on auditing (not allowed).
    anyway to tell from a data dictionary view or something like that if these were issued by a given session? The queries run for a few minutes, so I have a bit before his session disconnects to query the data. I can't get him to change his code to stay connected. Is there a view that shows parameter changes for a given session?
    oracle: 10.2.0.5
    4 alter session commands are:
    Alter session set sort_area_size=999999999;
    Alter session set hash_area_size=999999999;
    Alter session set db_file_multiblock_read_count = 128;
    alter session enable parallel dml;
    Edited by: Guess2 on Jul 17, 2012 12:49 PM

    i cant turn on trace cause he connects and disconnects and this would run immediately, I am not in a position to turn on system level tracing, add a trigger, or turn on auditing (not allowed). If Informatica connects to Oracle via network, capturing TCP/IP traffic and mining in it may be your last resort.
    you can get session's PDML status from
    select pdml_status from v$session;
    i cant turn on trace cause he connects and disconnects and this would run immediatelythis contradicts to your following statement
    The queries run for a few minutes, so I have a bit before his session disconnects to query the data.
    I can't get him to change his code to stay connected. Informatica should have debug. Ask him if he can go step by step.
    Edited by: user11181920 on Jul 17, 2012 5:53 PM

  • How to update session state from form field values without submitting page?

    Hi,
    I am new to Oracle APEX. I am using Oracle Apex 4.2 on Oracle 11g release 2. The problem is that when I am entering data on a form, when I enter a value in one field and move to the next field, how can I use the value of first field in the validation procedure of next field? I know that when we enter data in fields, the session state is not updated with these values until we submit the page... right... but I have seen that if there is a control of List box type, then Apex gives an option "Action When List changes" where we can choose option to update corresponding session state field with the value of list box item, without submitting the page.
    Now my questions is why this option is only available for List box items? why not for other item types like Text box, Check box,... ? can someone please help me with this?
    (the issue with update of session state depending on page submitting, is that we need a complete network round trip from client to server in order for it. However if we can update session state variables without submitting page, then we can avoid this network traffic).
    Any help will be greatly appreciated. Thanks in advance.

    Create a dynamic action on change and run a PL/SQL process there with the following code:
    BEGIN
       NULL;
    END;Page items to submit > your item.
    This will set the session state without submitting the form.
    Further examples here:
    http://apex.oracle.com/pls/apex/f?p=31517:229
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • Session state and browser cache - Back button problem

    Hi all,
    I have a problem (and unless I'm missing something I think we all do) with session state and use of the browser's Back button. I really hope I'm just being dumb...
    Background scenario:
    Page P has a sidebar list allowing the user to select what content is displayed (e.g. 'stuff relating to X, Y or Z' where X, Y and Z are rows in, say, a table of projects). When a list entry is clicked, we branch to page P with the value of the list item placed in an application-level item (call it G_PROJECT). Reports on page P use G_PROJECT in their WHERE clauses.
    So, click list entry X and G_PROJECT is set to X and page P shows reports for project X.
    Page P also has a set of buttons which branch to various edit pages which allow attributes of page P's current project to be updated. These pages similarly use G_PROJECT in their WHERE clauses.
    Problem scenario:
    1. The user goes to page P and picks project X off the list. Project X's stuff is displayed (G_PROJECT = X).
    2. The user then picks project Y off the list. Project Y's stuff is displayed (G_PROJECT = Y).
    3. The user then clicks the browser's Back button. The page is served from browser cache, so project X's stuff is displayed, but G_PROJECT still = Y.
    4. The user clicks an 'Edit' button; we submit, and branch to an edit page which displays (and will edit) data for project Y because G_PROJECT still = Y.
    This is SERIOUSLY BAD NEWS - apart from being confusing, the user's edit permissions on projects X and Y may differ, and so the user may be able to perform 'illegal' updates.
    I've read what I can on this forum and the rest of the web looking for ways to a) inhibit browsers' 'Back' functions and/or b) prevent pages being cached by the browser, but none of them have worked for me.
    Short of waiting for browser manufacturers to recognise that the web is now full of applications as well as static pages, and enable robust programmatic control of cache behaviour, does anybody know how the problem can be avoided - or at least detected?
    Thanks,
    jd
    Failed attempts to date:
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="cache-control" content="no-store">
    <meta http-equiv="cache-control" content="private">
    <meta http-equiv="cache-control" content="max-age=0, must-revalidate">
    <meta http-equiv="expires" content="Wed, 09 Aug 2000 01:01:01 GMT">
    <meta http-equiv="pragma" content="no-cache">
    Disallowing duplicate submission (page attribute).
    window.history.go(1);

    Thanks Scott,
    I may be being dumb here but I don't see how that would help...
    P250_PROJECT and G_PROJECT are currently kept in sync by app logic. Whichever is used to drive, if the page is rendered from cache then the app logic is not executed, so the rendered page contents are not those keyed by P250_PROJECT, as illustrated in steps 1-4 of the problem above.
    The user sees X, the session items say Y. The engine doesn't know what the user is seeing.
    when page P is POSTed, its hidden item P250_PROJECT should always be used to derive the application item G_PROJECT. Then whether the page was pulled from cache or rendered anew via a click from the sidebar link, the project ID is determined by the contents of that page.
    As I said above I tried this, with the 'Edit' branch set to:
    Set these items: G_PROJECT
    With these values: &P250_PROJECT.
    but it makes no difference. The project ID is not determined by the rendered page contents - the engine gets the value of P250_PROJECT from session state.
    I can code the 'Edit' pages such that they check permissions and if necessary redirect back to p250 (conditional before-header branch), but that's a clunky cure rather than the prevention I was hoping for.
    Please tell me if my understanding is incorrect.
    jd

  • Row fetching, session state, multi-page processing of 1 row - problems

    I'm building an application that's updating a couple of tables via an updateable view and an instead-of trigger. That portion of it works OK, EXCEPT for the problems that I'm having with the APEX end.
    I've got 3 pages; the first page reads the row in via the automated row fetch and has, say columns 1-20.
    Page 2 has, say, columns 20-40 and page 3 has the remainder.
    I have the row fetch set up conditionally so that it only executes the first time that page 1 is displayed. All the columns are set as Database Columns.
    It seems that if I fill in fields on page 1, move to page 2, and back to page 1, the contents of the fields on page 1 are destroyed unless I set their 'Source used' to 'Only when the current value in session state is null'.
    Furthermore, upon update (which is on page 3, via an automated row update), the only columns that get updated are those that exist on page 3. The column values from the other pages no longer exist.
    Does navigation to another page not retain the session-state of database-column items?
    Am I better off just writing my own processes to perform the updates?
    Any other suggestions?
    Frank

    Hello Frank,
    >>I have the row fetch set up conditionally so
    that it only executes the first time that page 1 is
    displayed …
    It seems that if I fill in fields on page 1, moveto page 2, and back to page 1, the contents of the
    fields on page 1 are destroyed unless I set their
    'Source used' to 'Only when the current value in
    session state is null'.
    It seems that the first sentence is not consistent
    with the second one. The only reason the values are
    destroyed, as you call it, is that the ARF is running
    again. What condition are you using on your ARF?
    In any case, the right way to deal with it is to
    change the source used to "Only …", as I understand
    you already did.
    Hi Arie,
    I set an item after the first ARF. I then have the ARF set to execute conditionally based on the presence of that item. (I also display a success message on the ARF, so I know that the ARF is only occurring once). I move to subsequent pages by submitting the current pages.
    >>Does navigation to another page not retain the
    session-state of database-column items?
    Navigating to another page does retain the session state values.
    It's depends on what you mean by navigating.
    Submitting the page set/update session state.
    Redirect without submitting the page will not
    set/update the session state.
    >>Furthermore, upon update (which is on page 3,
    via an automated row update), the only columns that
    get updated are those that exist on page 3. The
    column values from the other pages no longer
    exist.
    Automatic DML is working only with the current page
    items. You can't use it to insert/update other page
    items, even if they are in session state. However, in
    your case, it's not the Automatic DML performing the
    actual updates, but your triggers. Are your triggers
    relying on session state values?
    I think this statement 'Automatic DML is working only with the current page
    items.' answers my question. My trigger is working on session state values. It's an 'instead-of' trigger, so I was letting the automatic DML perform the 'update' on the view, while allowing the trigger to do the actual update of several tables that the view joins by referring to their :NEW. values in the trigger. Since the DML occurs on my last page, those were the only session state values that my trigger ultimately saw.
    >>Am I better off just writing my own processes to
    perform the updates?
    I believe the correct way is to submit the page and
    then branch to the next one. Submitting the page will
    save all your items in session state, and allow these
    items to be available for page 3 DML.
    Regards,
    Arie.I'm doing that already - all the values do appear to be in session sate, except only the items that are on the last page actually make it to the automatic DML update, which seems to agree with your previous statement.
    I suppose I could write my own process to perform the update, as the values are available in session state.
    Thanks,
    Frank

  • Saving session state in database table rather in websever for Ordering App

    Hi all,
    Ours is a ordering application (telecomm) domain.
    Currently, we are storing user sessions data (Order shopping cart session data) in middle tier (iPlanet web server) which inturn consumes lot of memory resources.
    Shopping cart could be in MBs if order is a huge business order.
    So in order to not to overtax web server (middle tier), we are thinking of storing session data directly in a database table to relieve the overhead on web server and make use of database for storage.
    I read that APEX (html db) is already using this "single metadata table" approach for session data management. But we are not using HTML DB to really look into.
    Can some one advise how to go about storing "user session data" directly in a "database table" for both storage and retrieval purposes instead of storing it in "webserver".
    How does this "metadata table" structure looks like. Is it more generic ?
    Really appreciate your time and help/suggestions.

    Joel,
    Thanks for your response. sorry, i meant to say that "the current application does not use APEX but will look into it".
    To build this is an utterly non-trivial exercise. Oh - it may not be so hard to save session state to a table when you POST a page. But you may want to reference this in many places, and it's a question of can you change all of these references to indirect references from session state in your application.In order to free up the load on webserver, we want to maintain session management in database. Could you please explain the above little more :
    How do we maintain the "user session" with "database table" ?
    Do we need to store "session data" at java object level or by page in database table ? How does the structure of this "metadata table" looks like.
    Thanks for your time.

  • Use session state values to set column value during insert/update

    I am building an APEX 4.2 application that uses the canned Data Loading control to upload csv data to a table.  I have modified the 'Select Data Source' page of the workflow and it now contains three LOV's that the user selects values from.  The selected values are stored in Session State.  As I'm new to APEX, I do not know how to reference Session State objects in the context of the Data Loading workflow so that the appropriate columns are set with the correct values.  My assumption is that the columns that are apart of the insert statement reside in a collection somewhere.  I just don't know how to loop through the collection, determine the correct column, and then set that column's value equal to the corresponding LOV value in Session State.

    Scott,
    This is in version 2.2.1 and there are no caching features available.
    The application does require login.
    I'm playing around with the APP_UNIQUE_PAGE_ID right now but I am finding that even in the builder if I edit the attributes of a report column and then try to edit another column it will bring up the last column I edited. Even if I use the record navigation buttons next to the Apply Changes button it will keep bringing me the same page over and over unless I constantly refresh the pages.
    Greg

  • Feature Request - show substitution string values in session state display

    Hi!
    I would like to request that in addition to page and application items and session state values that the value of substitution string values be shown. Another option would be to have a separate link (like session) to display them. This would allow developers to see all of the available substitution values and how they change across pages, etc.
    Thanks!
    Dave Venus

    Dave - What are some examples of values that you are not seeing in the session state report that would be useful?
    Scott

  • 4.2 select list on mobile page not setting session state

    Hi,
    Like I've done dozens of times in the past, I created a Select list that submits on change, and I expected session state to be updated accordingly.
    I tried this on a mobile page but session state is not updated for the item.
    Has anyone else experienced this?
    Scott

    Hi Scott,
    is it possible that you are hitting bug# 14680379 - PAGE SUBMIT ACTIONS DO NOT WORK FOR LONGER MOBILE SELECT LISTS, WHEN DEFINED TO FIRE WHEN THE SELECT LIST VALUE CHANGES
    on our Known Issues List http://www.oracle.com/technetwork/developer-tools/apex/application-express/apex-42-known-issues-1863578.html ?
    Is your select list selection displayed as native control or as popup? Can you create a test case on apex.oracle.com?
    Thanks
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Javascript setting value in session state

    I have a javascript that figures our the interest rate for a mortgage loan based on principal balance, term and monthly payment. The script also rounds up to the nearest 8th. Here is the line code that sets the value on the APEX form:
    document.getElementById('P2_NOTE_RATE_TO_PITIA_31').value = cRate.toFixed(3);
    Obviously this line code doesn't set session state for the value. Users have to submit the form again to pass this new rate to other calculations on the forms.
    Is there another piece of code I need to add to force value to session state? The javascript is called via the page load and it will produce the correct rate when ever values are changed to warrant a new interest rate to be calculated.
    Here is the entire javascript:
    function loanrate() { 
    function getVal(item){
    if($x(item).value != "")
    return parseFloat($x(item).value);
    else
    return 0 ;
    //Allow rates of 0 to 100%, solve to the nearest 0.001%
    var a=0.00001;
    var b=1;
    var tol=0.00001;
    var test;
    var t;
    var y1;
    var y2;
    var P = getVal('P2_NEW_BAL_CALC');
    var A = getVal('P2_NEW_PI_TARGET');
    var N = getVal('P2_REMAINING_TERM');
    var nRate;
    var cRate;
    var root;
    var TEMP = a;
    // Allow only 100 iterations (more than enough for convergence)
    for(var k = 1; k<=100; k++) {
    // A*(Math.pow((1+i),N)-1)/(i*Math.pow((1+i),N)) = present worth of N payments of A (beginning
    // 1 period from now)
    // Finally, subtract P (the present worth, or the price).
    i = a;
    y1 = A *(Math.pow((1+i),N)-1)/(i*Math.pow((1+i),N))- P;
    i = b;
    y2 = A *(Math.pow((1+i),N)-1)/(i*Math.pow((1+i),N))- P;
    test = y1*y2;
    // If test>0, the function that is to be driven to zero has the same sign
    // for both sides of the interval.
    if (test>0) {
    b = a;
    a = TEMP;
    a = (a+b)/2;
    } else {
    // If test <0, the root of the equation is between a and b.
    // If the interval is small enough, return (a+b)/2 as the root.
    // If not, bisect the interval: save a as TEMP, move a (new) halfway toward b.
    t = (b-a)/2;
    if (t<tol) {
    root = (a+b)/2;
    // Compute the annual compounded rate, if payments are monthly
    //var annual = 100*(Math.pow((1+root),12)-1);
    root = root * 100;
    nRate = Math.round(1000 * root)/1000 ;
    cRate = (Math.ceil((nRate * 12)/.125)*.125);
    document.getElementById('P2_NOTE_RATE_TO_PITIA_31').value = cRate.toFixed(3);
    //$x_Value('P4_ANNUAL_RATE',Math.round(1000*annual)/1000);
    break;
    } else {
    TEMP = a;
    a = (a+b)/2;
    }

    I believe the following will do what you need.
    document.getElementById('P2_NOTE_RATE_TO_PITIA_31').value = cRate.toFixed(3);
    var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=dummy',0);
    get.add('P2_NOTE_RATE_TO_PITIA_31',$x('P2_NOTE_RATE_TO_PITIA_31').value)
    gReturn = get.get();
    ...

Maybe you are looking for

  • Repeated System Hard Locks since iTunes 11.4 patch in full Screen apps.

    Firstly, the patches changes to iTunes U seems to have corrupted my iTunes library - I now have iTunes U content showing up randomly as Music, TV Shows, and Movies.  Also, many tracks have lost information. Secondly, I am getting the 'cannot sync, ou

  • Help with a network printer

    I'm at the end of my knowledge level here. I am trying to hook up a network printer that my IMac can print to. I have it connected to a printer sharing unit (Linksys PSUS4 named LK8295C2) at address 192.168.0.105. The printer is a Brother 1240 Laser

  • Dell Dimension 5150 Desktop fitted with a Cohiba w...

    Evening all, I have a Dell 5150 desktop PC with a Cohiba 3887 USB wifi adapter fitted, when I boot up the PC and login, the adapter status is "connected to BT Homehub 2 - TRT2", after about 1 minute the status changes to "unable to connect to your pr

  • University e-mail sync

    I currently am a college student a university which i have access to an e-mail account which uses outlook and i would only have access to it through the schools website. Now is anyone firmilar if i would be able to use an account like this and push m

  • Windows 10 TP Build 10041

    Hi Insiders I have downloaded and installed build (10041) but when it boots to set up the settings it sits on 30% i have left my laptop on all night and still on 30%. I shutdown and restored to 9926 now i have a error when updating  0x800705b4 i have