Update tabular report column value using AJAX

Hi,
I'm developing an online store application whereby I would like the user to be able browse a list of products (tabluar report), enter an order quantity against a product and click a 'Buy' button (column link). This should then update a collection with the selected product id and order quantity. However, I'm struggling with how to update the order qty column value.
See http://apex.oracle.com/pls/otn/f?p=33248:1 for an example
The report displays the products from demo_product_info table. I have an additional column in the report SQL for the order quantity (set to '1').
I'm using a column link on the product_id column that sets
P1_TEMP_PRODUCT_ID = #PRODUCT_ID#
P1_TEMP_QTY = #QTY_ORDERED#
then re-renders the page.
I have a page rendering process that takes the values from the temp items and updates a collection.
When the user changes the order quantity, how do I update session state so the new value is picked up by the column link?
Thanks,
Andrew.

To update session state you might check out this article titled, "ApEx: Setting session state from within a PL/SQL Package/Procedure/Function" at http://atulley.wordpress.com/2007/05/17/apex-setting-session-state-from-within-a-plsql-packageprocedurefunction/
It says:
The answer lies in the set_sesssion_state procedure found in the APEX_UTIL package. E.g.
APEX_UTIL.set_session_state(
p_name => ‘PX_MY_ITEM’
, p_value => ‘wibble’);
Now, I have a question for you. Once you set the value of the column in session state, how will you make that value be put in the database?
Thanks, Maggie

Similar Messages

  • How to accessing current row report column value in Lov Query?

    Hi,
    which access methods (eg. bind variables, substitutions, ...) for getting the current row report column value can be used in the "Lov Query" property of a report column?
    As what I know of and what I have read on the forum there are no bind variables for the report columns. For the "Link Text" property it seems that the column values exist as substitution strings (#COLUMN_NAME#). But they don't work in the Lov Query. => And would be good because of a hard parse each time the Lov query is executed.
    The following post (Re: Simulating a correlated sub query in lov
    is showing a solution to use package variables for temporary storage of the referenced value, but the only problem with that solution is that if a new record is added with the "Add rows to tabular form" process the package variable still contains the value from the last queried row! Is there a way (variable, APEX package, ...) to determine if the lov query is executed for a new record so that the package can return null?
    I know that I could write the package in a way that the value is immediately cleared when lov_pkg.keyval is called (one time read), but then I would have to create several variables if I'm accessing the value multiple times in the query or in another query => I think an one time read solution would be very obscurely.
    Thanks for your help
    Patrick
    http://inside-apex.blogspot.com

    Hi Patrick,
    I agree that it's a waste to continually use Ajax to go back to the server to get the contents of a dynamic select list.
    There are no bind variables for any row item - but what you do have, as per my previous post, is the value of the data entered by the user in the first row. You can pass this into your application process (using get.add("VARIABLENAME", value)), which can use it to retrieve the correct LOV in your Ajax code - this will give you a "bind variable" that your process can use.
    What you could do, however, is generate hidden select lists on your page - one for each possible LOV list and replace the contents of the new row's select list with the contents of the appropriate hidden select list. This is easy to do with javascript (using innerHTML functions). Obviously, though, the usefulness of this depends on the number and size of the select lists.
    Even if you don't generate them to start with, you can keep a copy of any select lists returned by Ajax in the DOM for use on new rows. So, if you have retrieved a select list, you will have a copy of it in DOM which you can then copy into the new row. If you don't have the list in DOM, use Ajax to get it, store a copy of it and copy it into the new row.
    Which method you use will depend on the number/size of select lists needed. If they are few in number and/or size, I would suggest generating hidden lists. If they are large, use Ajax to get them once, store them and then retrieve them from the DOM when needed.
    There is another thread here where Arie recommends going to the server every time to make sure you get the most up-to-date data for the lists. If you want to follow this advice, for this reason, use get.add("VARIABLENAME", value) to pass the value to your process. If this is not an issue, you can use one of the other methods I outlined above.
    Regards
    Andy

  • Column link - call java script & assign current report column value to item

    Hi,
    How to call java script and assing current report column value to item?
    I have a button column in the report to 'delete' the selected row.
    I want to first show dialog box with message 'Are you sure?'. If yes, process to delete
    will be executed, else no action.
    In order to fire JS, I used Column Link ->Target=URL.
    Problem: The alert is showing but I don't know how to pass selected row's primary
    key value to process (to delete selected row).
    I have a item which can be used to store selected primary key value but don't know how to assign the value
    when button pressed.
    Thanks in advance
    Dip

    Ok. The issue has been resolved by following way.
    PAGE PROCESS: delete_request
    begin
    delete xyz
    where id = :P8_id;
    commit;
    end;BUTTON URL:
    javascript: DelRec(null,'CREATE', 'f?p=&APP_ID.:8:&SESSION.:delete_request:NO::P8_id:#id#');Java Script:
    <script language="JavaScript1.1" type="text/javascript">
    function DelRec(msg, req, url){
    var confDel = msg;
    if(confDel ==null){
    confDel= confirm("Are you sure?");
    }else{
    confDel= confirm(msg);}
    if (confDel== true){
    redirect(url);           }
    </script>

  • Javascript - Referencing report column value

    Hi,
    In my application I have a report "Test" with some columns. In column "PFT_PCODE" the possible values are either 1 or 2.
    What I want is to display the report table cell in red, if the value in "PFT_PCODE" is 1, or the table cell in orange, if the value in "PFT_PCODE" is 2, respectively.
    I tried to make something in Javascript, based on a Vikas' example. I put in the
    Region Header:
    <style type="text/css">
    .rot {
    background-color: red;
    .orange {
    background-color: orange;
    </style>
    Region Footer:
    <script type="text/javascript">
    var spans=document.getElementsByTagName('span');
    for (var j=0;j<spans.length;j++) {
    if (spans[j].className=='farbe') {
    var td=html_CascadeUpTill(spans[j],'TD');
    if (document.getElementsById('#PFT_PCODE#').value == 1) {
    td.className = 'rot';
    else {
    td.className = 'orange';
    </script>
    The column "PFT_PCODE" is marked as CSS class "farbe".
    Unfortunately it's not working, I'm not sure if I reference the report column value right. Since I'm a beginner in Javascript I would be glad for help.
    I put my (reduced) application on apex.oracle.com for testing.
    Workspace: app
    Login: [email protected]
    PW: riponi
    Thanks in advance,
    Roger

    Hi Roger,
    In your report, if you do a View Source, do your report headers have id's on them - that is, the TH tags that contain the headings?
    If so, you could use:
    &lt;script type="text/javascript"&gt;
    function hilite(f1)
    var h = document.getElementById(f1);
    var t = h.parentNode;
    while (t.tagName != 'TABLE')
      t = t.parentNode;
    var rows = t.rows;
    var k;
    var j;
    var c;
    var headers = t.getElementsByTagName("TH");
    for (k = 0; k &lt; headers.length; k++)
      if (headers[k].id == f1)
        c = k;
    for (k = 1; k &lt; rows.length; k++)
      j = rows[k].getElementsByTagName("TD")[c];
      if (j.innerHTML == '2')
        j.style.backgroundColor = 'purple';
        j.style.color = 'yellow';
      if (j.innerHTML == '1')
        j.style.backgroundColor = 'red';
        j.style.color = 'white';
    &lt;/script&gt;Put that in the page's HTML Headers setting.
    In the report region's Region Footer, add in:
    &lt;script type="text/javascript"&gt;
    hilite('PFT_PCODE');
    &lt;/script&gt;This will find the heading's TH cell, work out where it is in the row, then loop through all remaining rows and check the TD cell in the same column, highlighting the cell using background and font colours.
    Andy

  • How to swap column values using variable in sql?

    Hi,
    I have a table and i want to swap two column values using variable
    please help me

    Hi,
    Let us assume that the DeptNAME and DeptNo columns are of type VARCHAR2. However, DeptNO column is VARCHAR2(10) and DeptNAMe is VARCHAR2(100).
    First of all DeptNo column needs to be modified to be 100.
    i) ALTER TABLE DEPT MODIFY DEPTNO VARCHAR2(100);
    Secondly, you will swap DEPTNAME and DEPTNO values using the SQL as follows:
    ii) update dept t1
    set deptname = (select deptno from dept2 t2 where t1.deptno = t2.deptno),
    deptno = (select deptname from dept2 t2 where t1.deptno = t2.deptno);
    Now, finally you want the deptname columns to be VARCHAR2(10)
    iii) ALTER TABLE DEPT MODIFY DEPTNAME VARCHAR2(10).
    If DEPTNO is a NUMBER column, you cannot alter the datatype unless the table is empty; in that case the whole swapping requirement would be moot.
    Trinath Somanchi,
    ( http://www.myospages.com )

  • Return all the column values using the F4IF_INT_TABLE_VALUE_REQUEST

    Hi,
    How to return all the column values using the F4IF_INT_TABLE_VALUE_REQUEST?
    For example : if the row has 3 columns then after selecting the particular row, the RETURN_TAB internal table should contain all the three column values.
    Regards,
    Raghu

    Hi,
       Try the following...
    DATA : it_fields like help_value occurs 1 with header line.
    data: begin of w_vbap,
            vbeln      like vbap-vbeln,    
            posnr      like vbap-posnr,   
            werks      like vbap-werks,  
          end of w_vbap.
    data: i_vbap   like w_vbap   occurs 0 with header line,
             w_fields type help_value,
          i_dfies type table of dfies,
          i_return_tab type table of ddshretval with header line,
          i_field  type dfies.
      select vbeln posnr werks
          from vbap into table i_vbap up to 5 rows.
    if sy-subrc = 0.
       sort i_vbap by vbeln.
    endif.
      clear it_fields[] , it_fields.
      it_fields-tabname = c_vbap.
      it_fields-fieldname = 'VBELN'.
      it_fields-selectflag = c_on.
      append it_fields.
      it_fields-tabname = c_vbap.
      it_fields-fieldname = 'POSNR'.
      it_fields-selectflag = space.
      append it_fields.
      it_fields-tabname = c_vbap.
      it_fields-fieldname = 'WERKS'.
      it_fields-selectflag = space.
      append it_fields.
      loop at it_fields into w_fields.
        i_field-tabname   = w_fields-tabname.
        i_field-fieldname = w_fields-fieldname.
        i_field-keyflag   = w_fields-selectflag.
        append i_field to i_dfies.
      endloop.
      call function 'F4IF_INT_TABLE_VALUE_REQUEST'
        exporting
          retfield               = 'VBELN'
         window_title           = 'Select'
        tables
          value_tab              = i_vbap
          field_tab                = i_dfies
          return_tab             = i_return_tab
       exceptions
         parameter_error        = 1
         no_values_found        = 2
         others                 = 3
      read table i_return_tab into w_return_tab index 1.
      if sy-subrc = 0.
      endif.
    Regards,
    Srini.

  • Update Property Promotion Column Value in InfoPath Document Library

    Hello All,
    I just tried to update a property promotion value using this code:
    using (SPSite site = new SPSite(webName))
                        using (SPWeb objweb = site.OpenWeb())
                            SPList spList = objweb.Lists["XYZ"];
                            SPQuery qry = new SPQuery();
                            qry.Query = @"<Where>" +
                          "<Eq>" +
                          "<FieldRef Name='ServiceR' /><Value Type='WorkflowStatus'>17</Value>" +
                          "</Eq>" +
                          "</Where>";
                            qry.ViewFields = @"<FieldRef Name='Title' /><FieldRef Name='Evaluation_x0020_Status' />";
                            SPListItemCollection listItems = spList.GetItems(qry);
                            objweb.AllowUnsafeUpdates = true;
                            if (listItems.Count > 0)
                                foreach (SPListItem item in listItems)
                                    if (item["Evaluation_x0020_Status"] == null)
                                        item["Evaluation_x0020_Status"] = "Evaluation Completed";
                                        item.Update();
                            objweb.AllowUnsafeUpdates = true;
    The code exexuted but the value does not updated !!
    Any Answer ?

    I resolve the issue using this link:
    http://nanettevb.blogspot.com/2011/03/cannot-update-promoted-fields-from.html
    Omar Attari

  • Unable to pass report column value to url in select statement. Please help

    Hi all,
    I am trying to pass the report column value as follows:
    select key, num,
    case when Attachmentcnt(KEY) != 0 then
    'f?p=&APP_ID.:91:&SESSION.:'' '':NO::P91_KEY,P91NUM,P91_PREVPG:'And I am passing values as follows:
    {noformat}
    '#KEY#,'#NUM#','9' ELSE null
    END Attachment
    from tableA
    {noformat}
    But, I am not able to figure out correct sysntax to pass these column values. Can anyone give me some help. I appreciate it.
    rgds,
    Suma.
    Edited by: sumak on Jun 23, 2009 12:11 PM
    Edited by: sumak on Jun 23, 2009 12:22 PM

    Suma,
    If you're trying to generate a column with a URL, try something like the following:
    select key, num,
    case when Attachmentcnt(KEY) != 0 then
    'f?p=&APP_ID.:91:&SESSION.:'' '':NO::P91_KEY,P91NUM,P91_PREVPG:'
    || tableA.key || ',' || tableA.num || ',' || :P91_PREVPG
    else NULL
    end
    FROM tableA;
    But the best way to pass these would include checksum values against the values of your parameters (to make sure a user doesn't hack them). You'll need to check the Apex User manual for details - See "Understanding Session State Protection".
    Good luck,
    Stew

  • How to sum a column value using CAML Query?

    Hi All,
    I would like to sum the column value using CAML qeury. Actually in my list, I have two column "Projects Name" and "Number of Issues". Now need to get sum of "Number of Issues" column. How to achieve in CAML Query.
    Thanks in advance!

    Hi Sam,
    it looks like you can use your current view based agregation, otherwise it is not possible(
    http://msdn.microsoft.com/en-us/library/ms467521.aspx) and you need to work on custom bit on this requirement.
    use the below link and create a view element as described and see if that works for you
    Aggregations Element
    http://msdn.microsoft.com/en-us/library/ms468626%28v=office.12%29.aspx
    Another reference
    Query Element
    http://msdn.microsoft.com/en-us/library/ms471093.aspx
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • How to get Metadata column values using powershell(CSOM)

    Hi,
    I am trying to get list column values using Powershell (CSOM), but I am getting for Metata data columns.
    I am getting internal value as System.Collections.Generic.Dictionary`2[System.String,System.Object] 
    Can anybody let me know how to get the values for metadata columns?
    Any help would be greatly appreciate.
    Thank you.
    AA.

    Hi
    Go through the links. It'll help.
    SharePoint 2013 Code Tips – Setting a Managed Metadata Field with the Client Object Model(CSOM and JSOM)
    Indul Hassan
    Microsoft Community Contributor
    http://www.indulhassan.com
    You Snooze.. You Lose !!

  • How to pass report column value

    I'm trying to implement a AJAX report pull from one of the response on this forum. The report column calls the following javascript function below. The #COL2# values are dotted values like 10.2.3.5.6. The function passes values correctly passed if the values are without special characters. I tried to put the value 10.2.3.5.6 in escape(10.2.3.5.6), but didn't work. Any ideas to pass this value in javascript encode/decode way is appreciated.
    javascript:GetReport(#COL02#)
    thanks,
    Surya

    Hello Surya,
    >> I have put an example on APEX site …
    This is indeed the best and fastest way to get help.
    >> but the third version value "1.2.3" fails to display …
    String parameters should be encapsulated with single/double quote signs.
    Your first two rows could have been considered as numbers, so the systems let them pass. The third one – 1.2.3 – is not a number, but you didn’t mark it as a string.
    I changed your code to the following:
    javascript:GetReport_r1('#COL01#');And now it’s working as you need.
    General remark: I saw in your report page that you are using the “Generic Column Names”. Just so you know, this not is the optimal choice. If you don't have to use it, you should use the first option of “Query Specific Column name”. If you have to use generic columns, try to minimize the number as close as you can to the real number of columns, and not just to default of 60.
    Regards,
    Arie.

  • Assigning External content type field column value using Client Object Model

    I have a problem assinging External column value to ListItem object with client object model-based application I'm developing. To be precise, I am able to retrieve data related to external content type by reading external list created from this content type
    but I don't know how to properly use it to assign value to this field. By doing some research on my own I concluded that BDC ID column from external list is the way to go since it uniquely defines selected row from external list but that doesn't
    tell me much since I don't know what to do with it. Currently I ended up with partial solution - to assign plain string value of picker column but that makes this value visible only in "View Properties" option on Sharepoint and not in "Edit Properties"
    which pritty much makes sence since it isn't properly related to rest of the data in specific row. Does someone have a better solution for this?
    Igor S.

    I think I understand your problem.
    In my example I have an external data column "Beneficiary Name", using a Beneficiary external content type (accessing a table of beneficiaries in a SQL table).
    I want to set the "Beneficiary Name" property using the client object model. I know the name of the beneficiary but not the ID value.
    It is a fairly simple solution. You just need to identify the name of the property SharePoint assigns to the ID field, in my case it is called "Beneficiary_ID". Then set the two properties as follows:
    thisItem["Beneficiary_Name"] = "Charitable Trust";
    thisItem["Beneficiary_ID"] = -1;
    thisItem.Update();
    Setting the ID property to -1 causes the server to do an automatic lookup for the ID from the value assigned to the item.

  • Update empty row / column values

    here is the sample data
    Col_1 -- col_2-----col_3-------col_4------col_5------col_6
    9--------111---------45-----------21
    7--------877
    2--------456
    8--------765
    I am trying to update the col_3,col_4,col_5,col_6 like
    Col_1 -- col_2-----col_3-------col_4------col_5------col_6
    9--------111---------45-----------21--------4654------6534
    7--------877---------67-----------42
    2--------456---------845----------4563
    8--------765
    How to insert/update the col_3,Col_4,Col_5,col_6 by adding values in sequence, I want insert the values in 2nd row then 3rd row etc.
    how to select next empty row of the particular column without including the other column values in where condition.
    Using ROWNUM or ROWID it's possible selecting the next row of the particular column ?
    Thanks in advance.

    following query i use for something:
    with
    week1 as (select decap as decap_w1,desrvid as desrvid_w1 from drdiskspace where deweek = to_char(sysdate,'WW')-1),
    week2 as (select decap as decap_w2,desrvid as desrvid_w2 from drdiskspace where deweek = to_char(sysdate,'WW')-2),
    week3 as (select decap as decap_w3,desrvid as desrvid_w3 from drdiskspace where deweek = to_char(sysdate,'WW')-3),
    week4 as (select decap as decap_w4,desrvid as desrvid_w4 from drdiskspace where deweek = to_char(sysdate,'WW')-4),
    week5 as (select decap as decap_w5,desrvid as desrvid_w5 from drdiskspace where deweek = to_char(sysdate,'WW')-5),
    week6 as (select decap as decap_w6,desrvid as desrvid_w6 from drdiskspace where deweek = to_char(sysdate,'WW')-6),
    week7 as (select decap as decap_w7,desrvid as desrvid_w7 from drdiskspace where deweek = to_char(sysdate,'WW')-7),
    week8 as (select decap as decap_w8,desrvid as desrvid_w8 from drdiskspace where deweek = to_char(sysdate,'WW')-8),
    week9 as (select decap as decap_w9,desrvid as desrvid_w9 from drdiskspace where deweek = to_char(sysdate,'WW')-9),
    week10 as (select decap as decap_w10,desrvid as desrvid_w10 from drdiskspace where deweek = to_char(sysdate,'WW')-10)
    select desrvnaam || ' ' || desrvschijf, decap, decap_w1, decap_w2, decap_w3, decap_w4, decap_w5, decap_w6, decap_w7, decap_w8, decap_w9, decap_w10
    from drdiskspace, drserver, week1, week2, week3, week4, week5, week6, week7, week8, week9, week10
    where drdiskspace.deweek = to_char(sysdate,'WW')
    and drdiskspace.desrvid=drserver.desrvid
    and drdiskspace.desrvid=desrvid_w1
    and drdiskspace.desrvid=desrvid_w2
    and drdiskspace.desrvid=desrvid_w3
    and drdiskspace.desrvid=desrvid_w4
    and drdiskspace.desrvid=desrvid_w5
    and drdiskspace.desrvid=desrvid_w6
    and drdiskspace.desrvid=desrvid_w7
    and drdiskspace.desrvid=desrvid_w8
    and drdiskspace.desrvid=desrvid_w9
    and drdiskspace.desrvid=desrvid_w10
    and drdiskspace.desrvid=:P200_ZOEK;
    greatz,
    Jan Louis

  • How to refresh a report column value alone.

    Hi All,
    If we have a static report and for one of the columns of report, if I need to give a feature to click on it and a popup appears and there is a checkbox to select values on that popup page and finally after making changes and I press on apply changes, It should close the popup window and then come and change the value of that column alone in original report instead of refreshing the whole page.
    The column of the report is of type "Standard Report Column".
    How can I achieve this functionality?
    Thanks & Regards,
    Vikas
    Edited by: Vikas Krishna on Sep 29, 2009 9:47 PM

    Vikas,
    I slightly modified on of my older examples and you will find everything here:
    http://apex.oracle.com/pls/otn/f?p=31517:241
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    ------------------------------------------------------------------------------

  • Update all null columns value in single row statement

    4) Write a single SQL statement to update all the columns of a table to have -9 instead of null value
    e.g:
    Before update:
    C1     C2     C3
    null     9     null
    10     null     88
    12     8     0
    After update:
    C1     C2     C3
    -9     9     -9     
    10     -9     88
    12     8     0
    Thanks

    Hi,
    Update < table name >
    set column name = nvl(column name, -9),
    column name = nvl(column name, -9)
    Regards
    Message was edited by:
    Seshu

Maybe you are looking for

  • Changing email address on iCloud account

    My email was hacked a while ago, and I managed to change email addresses on most accounts I can't seem to change the address on my iCloud account, any help please?????!!!!

  • Read Excel file and populate in a Table

    Hi, I have a requirement in which i have to read a Excel file and populate it thoroughly in a Table. The rows and column numbers are uncertain. Help me on this... Regards, Krish

  • Widget doesn't work after updating to OSX 10.6.8

    After installing the latest batch of updates, my sudoku widget doesn't work anymore. Anyone else having a problem like this, or know how to fix it? I noticed on the website which created it that others are also having this problem in the last few day

  • Time Machine does not erase old backups

    Hi, I have a problem using Time Machine on my MacBook Air. I use a LaCie 500GB Rugged All-Terrain Hard Drive for backup. The external drive has 3 partitions, one of which is dedicated to time machine and measures 128 Gb. It happens very often that I

  • JDeveloper Internal Exception

    When editing java source code, a window pops up multiple times: JniPortal for C:\Java\JDev20\java\bin\javai.dll reported java.lang.NullPointerException java.lang.NullPointerException at borland.jbuilder.ide.zip.IdeZipFile_Impl.listEntries (Compiled C