Home » Developer & Programmer » Application Express & MOD_PLSQL » Conditional Column Formatting in an Interactive Report?
icon4.gif  Conditional Column Formatting in an Interactive Report? [message #528927] Thu, 27 October 2011 12:15 Go to next message
mr_hotshot_818
Messages: 24
Registered: October 2009
Junior Member

Is it possible to add conditional column formatting in an Interactive Report in Apex 4.1? I've found numerous examples for older versions using the standard (classic) report, but I haven't found any with the new Interactive Report. Is this possible? and if so, can someone point me in the direction of some documentation or examples?
I simply want to change the color of the text depending on whether a column has a value (eg. Error or Problem).


Note -- I am not referring to the Highlight capability in the Action Menu.

Thanks
Re: Conditional Column Formatting in an Interactive Report? [message #528962 is a reply to message #528927] Thu, 27 October 2011 14:53 Go to previous messageGo to next message
Littlefoot
Messages: 19815
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Here's one option.

For example, I want to paint department name to "red" if department number is equal to 20. Interactive report's query looks like this:
select 
  deptno,
  case when deptno = 20 then '<span style=color:red>' || dname
       else dname
  end dept_name,
  loc
from dept

Modify DEPT_NAME's "Display Text As" property to "Standard Report Column" (if you skip this step, you'll see the tags instead). Finally, run the report. This is the result:

./fa/9506/0/

Re: Conditional Column Formatting in an Interactive Report? [message #528982 is a reply to message #528962] Thu, 27 October 2011 18:55 Go to previous messageGo to next message
mr_hotshot_818
Messages: 24
Registered: October 2009
Junior Member

Thanks!

I have a question: When you click the Dept_Name header and use a filter on RESEARCH, the filter doesn't show Dept Name = 'RESEARCH'. It displays Dept Name = '<span style="color:red">RESEARCH</span>'. Can this be avoided?


./fa/9508/0/

[Updated on: Thu, 27 October 2011 19:04]

Report message to a moderator

Re: Conditional Column Formatting in an Interactive Report? [message #606220 is a reply to message #528982] Tue, 21 January 2014 04:42 Go to previous messageGo to next message
sanjeevi
Messages: 2
Registered: February 2009
Location: chennai
Junior Member
We had a similar problem in our company and used Dynamic Action and Jquery to resolved the above problem.
$("td[headers='Dept Na']").each(function(index){
if($("td[headers='Dept status']").eq(index).text() == 'N'){
$(this).css({"color":"red"});
}
});
Also removed Span tag from the SQL Query which we used in the Interactive Report

Re: Conditional Column Formatting in an Interactive Report? [message #608948 is a reply to message #528927] Thu, 27 February 2014 05:55 Go to previous message
imontero
Messages: 4
Registered: February 2014
Junior Member
Hi,

I also use jquery and dynamic actions. When the report is generated the following is also called:

Function and Global Variable Declaration
function Col_Formatting()
{
$(".apexir_WORKSHEET_DATA td:nth-child(n+10):contains('N')").css({"font-weight":"bold","color":"red"});
$(".highlight-row td:nth-child(n+10):contains('N')").css({"font-weight":"bold","color":"red"});
}


What the code above is doing is to highlight in red the columns based on the value in "contains" as of column number 10. apexir_WORKSHEET_DATA and highlight-row are the report classes I am applying the css to. This is called through a Dynamic action.

Hope this helps!

[Updated on: Thu, 27 February 2014 05:56]

Report message to a moderator

Previous Topic: Invoke external stored procedure from apex
Next Topic: Apex 4.2.4
Goto Forum:
  


Current Time: Thu Nov 27 07:21:34 CST 2014

Total time taken to generate the page: 0.09653 seconds