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

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 in report column headings?

    Hello,
    I'm wondering if it's possible to be able to use Javascript in report column headings, so that when the user hovers the mouse over the column heading name in the report, a pop-up appears with an explanation of what that column is. Usually I use Javascript on page items, but in this case, the column headings aren't page items, they are derived from the SELECT statement that makes the report. Is this possible using Javascript? Or, is there something I'm not aware of that Apex can do, such as the "Optional Label with Help" but for column heading names?
    Thank you,
    Laura

    Hello Laura,
    Each report column headings has an ID equal to the column name/alias as it appears in your select statement. You can use this ID to directly access the column header DOM node, just as you are doing with a page item.
    In your case, you can use the ‘title’ attribute to get what you want. If your column ID is ‘COL1’, you can use something like this in the footer of your report region:
    $x(‘COL1’).title = ‘Help Text’;Of course, having an ID allows you to use any JavaScript code you need.
    Hope this helps,
    Arie.

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

  • Display an alert message through javascript when report column item is null

    Hello,
    I have a report column item which is an select list item and now i want to display an alert message when value is null, I mean no value is selected, this alert message should be fired when update button is clicked.
    Can anyone please help me with this issue.
    Thanks,
    Orton

    You could try something like this:
    declare
      x        INTEGER;
      err_ct  INTEGER   := 0;
    begin
      x  := 5;  -- number of rows displayed
      for i in 1 ... x (
        IF wwv_flow.g_f08(i)) IS NULL THEN err_ct  := err_ct + 1;
        END IF;
      end loop;
      IF err_ct = 0 THEN
         RETURN NULL;
      ELSE
        RETURN 'Nice error message: you must supply a value.';
      END IF;This would be used with a PL/SQL validation: Function Returning Error Text.

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

  • Filter the report based on the parent report column values

    Hi,
    period --- jan12 feb12 mar12...
    tickets --- _3_ _10_ _16_ .....
    This is my report layout.When i click on the no.of total tickets 3/10/16.It need to navigate to another report which should be filtered based on the reporting period as well as total tickets.
    How can i achieve this requirement.Is there any possibility to pass the column values from one report to another report?
    I tried "filter based on the another request" but it not worked for me.
    The summary of the requirement is when i click on 3 it need to display the 3 tickets details only...
    Anyone please help me out.
    thanks,
    prassu

    If your query means that for Jan 12 there are 3 tickets and for Feb 12 there are 10 tickets in the database, then you should only need to make the Period Column Is Prompted in the detail report. If the action link is not working this way then something else is wrong. Is the detail made from the same subject area?

  • Referencing Aggregated Column Value in Where Clause

    Hello -
    I'm trying to determine how I can accomplish the following in the most straightforward, efficient way.
    Among other things, I'm selecting the following value from my table:
    max(received_date) as last_received_dateI also need to evaluate the "last_received_date" value as a condition in my where clause. However, I can't reference my aliased "last_received_date" column value, and when I try to evaluate max(received_date) in the where clause, I get the "group function is not allowed here" error.
    Does anyone know of a good workaround?
    Thanks,
    Christine

    Hi,
    Column aliases can be used in the ORDER BY clause: aside from that, they cannot be used in the same query where they are defined. The workarounds are
    (a) define the alias in a sub-query, and use it in a super-query, like Someoneelse did, or
    (b) repeat the aliased expression, as in the HAVING-clause, below.
    Aggregate functions are computed after the WHERE-clause. (That explains why you can do things like
    SELECT  MAX (received_date) last_received_date_2008
    FROM    table_x
    WHERE   TO_CHAR (received_date, 'YYYY')  = '2008';).
    The HAVING-clause is like the WHERE-clause, but it is applied after the aggregate functions are computed, e.g.
    SELECT    deptno
    ,         MAX (recieved_date)  AS last_received_date
    FROM      table_x
    GROUP BY  deptno
    HAVING    MAX (received_date)    > SYSDATE - 7   -- Only show deptartments with activity in the last week
    ;

  • Referencing report columns in the BLOB download link format mask

    Hi there,
    In a basic report (Apex 4) I have a link to download a BLOB stored in the table. However to save space, instead of using 2 columns, one for the file name and one for the download link, I want to use only one column where the file name is the download link itself.
    To do this, I tried using this download link format mask (ATTACH_FILENAME is the report column that contains the file name):
    DOWNLOAD:ATTACHMENTS:ATTACH_BLOB:ATTACHMENT_ID::ATTACH_MIME_TYPE:ATTACH_FILENAME:::attachment:#ATTACH_FILENAME#
    However it shows #ATTACH_FILENAME# in all rows instead of the actual file name!
    I know that using substitution strings (&) works, so is there a way to also reference report columns in this format mask?
    Thanks
    Luis

    Luis, did you finally resolve this? I have the same question.

  • Hiding a report based on Action Link on report column values in OBIEE 11g

    Hi All,
    I have two Daashboard pages. In Page1, I have Report1.
    In  Page2, I have Report 2  and Report 3  in different sections.
    My requirement is, to create Action Link on two columns in Report1. Column1 should be navigated to Report2  in Dashboard Page2 and Column2 should be navigated to Report3 in the same Dashboard Page.
    Is it possible to use variables to hide Report2 when we click on Column1 and Report3 when we click on Column2.
    If yes, how to achieve this requirement?
    Please help me out.
    Thanks in Advance.

    Please see the following thread - I just implemented exactly what you are looking for. The bad thing is that it does require adding an additional column to all of your reports.
    https://community.oracle.com/thread/2483725
    Thanks,
    ~KKT~

  • JavaScript: Disabling textarea in report column cell  depending on flag

    Hi,
    I got an updateable report with the following behavior:
    - Depending on the value of column "PFT_PCODE" (1 or 2) the column gets a yellow or red background color.
    - If the value of column "PFT_PCODE" is 1 the next column (for remarks) gets a grey background color.
    - Some flags get values set.
    With the kind help of Andy (ATD) I got that running nicely. See also:
    Javascript - Referencing report column value and
    JavaScript: Disabling textarea in report column cell
    Now I want to add an additional feature:
    - If a flag ('P11_SPERR_FLAG') has the value '1' then the column (remarks) (var j) should be disabled.
    I tried the following (see additional code between asterisks) but it's not working. I feel a little stupid since I thought that shoud be an easy fix.
    Anyone has an idea what's wrong with the additional code? I find debugging quite difficult in JavaScript...
    ////////////////// PAGE HTM HEADER //////////////
    function hilite(f1) {
    var ft1 = document.getElementById('P11_FEHLERTYP1_FLAG');
    ft1.value = '0';
    var ft2 = document.getElementById('P11_FEHLERTYP2_FLAG');
    ft2.value = '0';
    *var sperrflag = document.getElementById('P11_SPERR_FLAG');*
    var h = 0;
    if (document.getElementById(f1)) {
         h = document.getElementById(f1);
         var t = h.parentNode;
         while (t.tagName != 'TABLE') {
              t = t.parentNode;
         var rows = t.rows;
         var k;
         var i;
         var j;
         var c;
         var headers = t.getElementsByTagName("TH");
         for (k = 0; k < headers.length; k++) {
              if (headers[k].id == f1) {
                   c = k;
         for (k = 1; k < rows.length; k++) {
              i = rows[k].cells[c];
              j = rows[k].cells[c+1].getElementsByTagName("TEXTAREA")[0];
              *if (sperrflag.value == '1') {*
    *               j.disabled = 'true';*
              if (i.innerHTML == '2') {
                   i.style.backgroundColor = 'yellow';
                   i.style.color = 'white';
                   i.style.fontWeight = 'bold';
                   i.style.fontSize = '18px';
                   ft2.value = '1';
              if (i.innerHTML == '1') {
                   i.style.backgroundColor = 'red';
                   i.style.color = 'white';
                   i.style.fontWeight = 'bold';
                   i.style.fontSize = '18px';
                   j.style.backgroundColor = 'grey';
                   ft1.value = '1';
                   //j.disabled = 'true'; //This would work.
    ////////////////// REGION FOOTER //////////////
    <script type="text/javascript">
    hilite('PFT_PCODE');
    </script>Thank you,
    Roger

    I found the solution, it had nothing to do with JavaScript:
    Item P11_SPERR_FLAG was of type Diplay as Text / Doesn't save state.
    Without saving state the JavaScript wouldn't work.
    Sorry to bother,
    Roger

  • JavaScript: Disabling textarea in report column cell

    Hi,
    Andi (ATD) helped me with formatting report columns, coloring them depending on a value. See:
    Javascript - Referencing report column value
    Now I want to add a feature:
    If the value is '1' then disable the textarea in the next column, otherwise not. The function is:
    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 i;
    var j;
    var c;
    var headers = t.getElementsByTagName("TH");
    // var textarea = t.getElementsByTagName("textarea");
    for (k = 0; k < headers.length; k++)
      if (headers[k].id == f1)
        c = k;
    for (k = 1; k < rows.length; k++)
      i = rows[k].cells[c];
      j = rows[k].cells[c+1];
      if (i.innerHTML == '2')
        i.style.backgroundColor = 'yellow';
        i.style.color = 'white';
        i.style.fontWeight = 'bold';
        i.style.fontSize = '18px';
      if (i.innerHTML == '1')
        i.style.backgroundColor = 'red';
        i.style.color = 'white';
        i.style.fontWeight = 'bold';
        i.style.fontSize = '18px';
    //  j.style.backgroundColor = 'green';   // testing purpose; colors background green but not textarea
        j.style.visibility = 'hidden';               // works fine but ugly
    //  j.disabled = 'true';                        // nothing happens
    //  j.firstChild.disabled = 'true';           // does not work
    //  j.textarea.disabled = 'true';           // does not work
    }See the 'j' object: I can make the whole cell disappear but it looks ugly. Examining it with firebug I was thinking I must use sth. like firstChild or textarea, but it does not work. I find it still quite tricky to manipulate tables in Apex...
    Could someone help with this?
    Thanks a lot,
    Roger

    Hi Roger,
    You're sort of nearly there!
    The next cell to the right of the one you are testing will contain a TEXTAREA object. Your j variable can get to this using something like:
    j = rows[k].cells[c+1].getElementsByTagName("TEXTAREA")[0];The issue with using the visibility method that you have used will then disappear as you've applied it to the whole TD object, so all borders will go - applying this to the new j will only hide the textarea object instead.
    Andy

Maybe you are looking for

  • Inspection lot  is not getting updated in quant

    Hi Experts, Need your help.. I have posted two material doc with same material following is the consequences : 1.we have immediate TO creation process , so now we have 2 TO's and 2 inspection lots. 2.When i am doing UD for first inspection lot PCN do

  • Summarization Levels COPA

    Hello all, I´ve created a Summarization Level using transaction KEDV. The Summarization Level has still the status "to be created" in KEDV, even when I safe it, it does not change the status, so the tables are not built. When I try to update/ built/

  • Opt-click & drag to copy doesn't work..why???

    Hello, I am having trouble with the shortcut copy & drag command (holding down option while dragging a note event or region.) It only seems to work about half the time- frequently, it moves the event instead of moving a copy. Then I have to undo & tr

  • Problem with SUM () analytic function

    Dear all, Please have a look at my problem. SELECT CURR, DT, AMT, RATE, SUM(AMT) OVER (PARTITION BY CURR ORDER BY DT) SUMOVER, sum( amt * rate) over (PARTITION BY CURR ORDER BY DT) / SUM(AMT) OVER (PARTITION BY CURR ORDER BY DT) avgrt FROM select 'CH

  • BADI in BW Report

    Hello Experts, I need some advice from an expert or anyone with BADI experience.  I have to run a report that calculates an accrual value based on a future date. This requires me to use a virtual key figure and calculate it dynamically when the query