JavaScript - referring to the value of the report column

Hello

In my application, I have a 'Test' relationship with some columns. In the "PFT_PCODE" column values can be 1 or 2.
What I want is to display report in red table cell, if the "PFT_PCODE" value is 1, or table at orange cell, if the "PFT_PCODE" value is 2, respectively.

I tried to do something in Javascript, based on the example of a Vikas. I put in the

Header of the region:

< style type = "text/css" >
{.rot}
background-color: red;
}
.Orange {}
background-color: orange;
}
< / style >


Footer area:

< script type = "text/javascript" >
var spans = document.getElementsByTagName ('span');
for (var j = 0; j < spans.length; j ++) {}
If (spans [j] .className == 'farbe') {}
var td is html_CascadeUpTill (spans [j], 'TD');.
If (document.getElementsById('#PFT_PCODE#').value == 1) {}
td.className = "rot";
}
else {}
td.className = 'orange ';
}
}
}
< /script >

The "PFT_PCODE" column is marked as "farbe" CSS class

Unfortunately it does not work, I do not know if I have the right to report to reference the column value. Since I'm a newbie in Javascript, I'd be happy to help.

I put my request (reduced) on apex.oracle.com for the test.
Workspace: app
Login: [email protected]
PW: riponi

Thanks in advance,

Roger

Hello

OK - the problem is that some of your columns had tables in the cells and it was upsetting the javascript!

I have changed the script:

<script language="JavaScript" type="text/javascript">
<!--

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 < headers.length; k++)
 {
  if (headers[k].id == f1)
  {
    c = k;
  }
 }
 for (k = 1; k < rows.length; k++)
 {
  j = rows[k].cells[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';
  }
 }
}

//-->
</script>

and it seems to be ok

Andy

Tags: Database

Similar Questions

  • JavaScript: Disabling text box in the report column cell

    Hello

    Andi (ATD) helped with formatting of columns in the report, their coloration depending on a value. See:
    JavaScript - referring to the value of the report column

    Now, I want to add a feature:
    If the value is "1" then turn off the text box in the column next, otherwise no. 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 object of 'j': I can do the whole cells disappear, but it's ugly. It examines with firebug I thought I should use sth. such as firstChild or textarea, but it does not work. I find always pretty hard to manipulate tables in Apex...

    Could someone help with this?
    Thank you very much
    Roger

    Hi Roger,

    «"" You're sort of almost here!»»»

    The next cell to the right of the one that that you are testing contains a TEXTAREA object. Your variable j accesses it using something like:

    j = rows[k].cells[c+1].getElementsByTagName("TEXTAREA")[0];
    

    The problem with the help of the method of visibility you have used will disappear while you applied to the entire purpose of TD, so all the borders will go - this application to the new j allows to hide the textarea rather object only.

    Andy

  • What region in the report column HTML link?

    Dear gurus of the Apex,
    OK, I'll go straight to my question. I have a page to download file with region (conditional) report that comes after the file download process. According to the report that I have a column to remove the file downloaded (column has an image link, the target application, the name of the option: P2_DELETE_ID value: #DOC_ID #). Basically the report picks up just downloaded file ID and allows me to delete the file by having Hiden point Page (P2_DELETE_ID) and before the process of header:
    BEGIN
    REMOVE FROM EBA_ASSET_ORDER_TEMP_DOCS
    WHERE annual =: P2_DELETE_ID;
    END;
    condition: Expression 1 value is not Null, and the value of the Expression 1:
    P2_DELETE_ID
    I and another conditional region (which is HTML) he comes after the file download process as well. The Source region is:
    & lt; div id = "FinalMessage" > & lt; / div >
    & lt; br / >
    & lt; div > & lt; a href = "javascript:confirmFileDelete(htmldb_delete_message,'f?p=&APP_ID.:2:&SESSION.:REMOVE_ID:::P2_DELETE_ID:#DOC_ID#')"; > & lt; "img > src="/i/delete.gif "style =" position: relative; " Top: 1px; ' / > delete the downloaded file & lt; /a >
    & lt; / div >
    where id = "FinalMessage" - is the JS success/error message
    and... href = "javascript:confirmFileDelete--is my real question. So I try to hide my region to report and show only my region HTML where I will be able to this (... href...) link delete file from my table. I am able to dele file using report link colum but my... href... link dosnt want to delete my file, doen't even want to pick up the ID of file. Is there a way where I can link my... href... link to pull the report column?

    Thank you

    NP - now access, so I will have a look

    Andy

  • Need help with Javascript to get the value of standard report column

    Hi all

    Apex 3.1 version

    I have a query SQL (editable report) region where I need to do validations using a process of OnDemand and javascript. For this posting, I need to use the serial number and id of this same report line item. The function is called when the serial number is changed. I can get the serial number easily because it is a text field, however, the item id is a standard report column (which actually a text field or hidden gives me a checksum error, long story). How can I get the value of the standard report column to set the value of an element of the Application to use in my process of application as well as the serial number? Here is my code below.
    <script>
    
    function f_ValidateSerial(pThis)
    {
        
      // The row in the table
    
      var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
    
        //alert('Row is '+vRow);
    
    
      // Display the serial number
        //alert('The Serial Number is '+html_GetElement('f21_'+vRow).value);
    
      
     var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=ValidateSerial',0);
     get.add('F101_SERIAL_NUMBER',html_GetElement('f21_'+vRow).value);
     get.add('F101_INVENTORY_ITEM_ID',+html_GetElement(?????+vRow).value);   // Here's where I need to get the item id to set application item!!
     
     gReturn = get.get();
     
    if (gReturn)
        { 
          alert(gReturn);
        }
     
      if(gReturn)
        { 
          html_GetElement('f21_'+vRow).value = '';
        }
               
    }
    </script>

    Hello

    Ok

    Item ID is standard report column.
    If you enter this Expression HTML column

    #ITEM_ID#
    

    I guess that the substitution of column item Id is #ITEM_ID #.

    Now, you have hidden input form that is not submitted.
    Then in JavaScript

    get.add('F101_INVENTORY_ITEM_ID',+html_GetElement('item_id_'+Number(vRow)).value);
    

    Kind regards
    Jari

  • By the way the value of the report column in Javascript

    Dear magicians Apex,
    I am a bit stuck now to implement a modal pop-up/iframe/javascript and this forum is my last hope to solve this problem.
    Anyway, I will try to explain what I'm trying to accomplish.
    What I need, is: I want to have a SQL report, as first column I want to have an 'ID' of my table numbers and I want this column to have a "link in the column" located in the appropriate links "column attributes. The thing is that when I click on the link of the column (when I run my report on the Apex page) I need a JQuery modal window where the pop-up in IFrame will be another page and this page uses an 'ID' of my link URL column to display the data. So, basically, I want to pass a value of 'ID' of my page parent to my page of the child which appears in an iFrame modal window.
    And here's what I have:
    1. I have a SQL report:
     
    select SUBNET_ID, 
           long2ip(NETWORK_ADDRESS), 
           long2ip(SUBNET_MASK), 
           long2ip(END_HOST), 
           long2ip(START_HOST), 
           MAX_HOSTS, 
           long2ip(BROADCAST_IP), 
           NETWORK_CLASS, 
           NETWORK_SIZE, 
           HOST_SIZE 
    from   YC_CM_IP_SUBNETS 
    2 then, in 'The column attributes' to 'SUBNET_ID' a have put a "link in the column" URL like:
    javascript:ViewNetworkDetails(#SUBNET_ID#);
    3. now, when I run my page and point my mouse over any item in my column "SUBNET_ID", I see that she receives a number of "SUBNET_ID" of my table and it shows it in the button of the browser as:
    javascript:ViewNetworkDetails(1);
    , or (2) or anything that is 'SUBNET_ID '. So, that's good.
    4 and here I am confused, basically, I need to pass a value of
    javascript:ViewNetworkDetails(#SUBNET_ID#);
    , which seems to work as it gives me good numbers of my table to my 'ViewNetworkDetails' JavaScript function, then it can paste this value in "f?" p =... "IFrame URL. Here is my Jquery Modal script form and Javascript to redirect me to my popup page (the script is located in the HTML header):
     
    <script type="text/javascript"> 
    function ViewNetworkDetails(){ 
    var apexSession = $v('pInstance'); 
    var apexAppId = $v('pFlowId'); 
    var subnetIDNumber = document.getElementById(#SUBNET_ID#); 
    
    $(function(){ 
    vRuleBox = '<div id="ViewNetworkDetailsBox" title="View Subnet Details"> 
    <iframe src="f?p='+apexAppId+':103:'+apexSession+'::NO:103:P103_SUBNET_ID:'+subnetIDNumber+'
    "width="875" height="500" title="View Subnet Details" frameborder="no"></iframe></div>' 
    $(document.body).append(vRuleBox); 
    $("#ViewNetworkDetailsBox").dialog({ 
                            buttons:{"Cancel":function(){$(this).dialog("close");}}, 
                            stack: true, 
    modal: true,                             
                            width: 950,                     
    resizable: true, 
    autoResize: true, 
    draggable: true, 
    close : function(){$("#ViewNetworkDetailsBox").remove(); 
                            location.reload(true); } 
    }); 
    }); 
    } 
    </script> 
    PS My hypothesis is that there is a problem with this part of my script
    var subnetIDNumber = document.getElementById(#SUBNET_ID#); 
    where I can't get my "SUBNET_ID" value from
    javascript:ViewNetworkDetails(#SUBNET_ID#);
    in 'subnetIDNumber' variable and that's why I can't spend my iFrame URL.

    P.S. P.S. the child page 103 has a "Automated row fetch", is not a problem. In addition, I did a simple test, where I had a page element 'P102_Value' with values and in my script I had instead
    var subnetIDNumber = document.getElementById(#SUBNET_ID#); 
    This
    var subnetIDNumber = $v('P102_Value'); 
    and it worked perfectly fine... but cannot operate against the SQL Select statement :-(

    HEEEEEEEEEEEEEELLLLLPPPP.
    Thank you

    Change your column to link to send the value of the subnet_id column to the function call (you mentioned, but I don't know if you've actually done m)

    JavaScript:ViewNetworkDetails(#SUBNET_ID#);

    You pass the value of the parameter to the function, but not defined all the parameters in the function definition (this is possible in JS, no other parameter is ignored)
    For example, to change the function to accept the subnet ID parameter (I'm really surprised how you missed it) and assign this parameter to a variable.