Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

conditional color formatting for pl/sql query

3275770Aug 17 2016 — edited Aug 17 2016

Oracle apex -4.2

Default theme

desktop application

So i had to color the rows of my report based on comparing a column from the report to a column from a different table.

so till I had  a static query

select TIME,                        

ELAPSED_TIME,             

case when ELAPSED_TIME < (Select SECS from DASHBOARD_PERF where DBNAME = 'DB1') then 'green'

          when ELAPSED >= (Select SECS from DASHBOARD_PERF where DBNAME = 'DB1')) then 'red'

       end the_color 

from DB1_PERFORMANCE

the below method worked:

https://tylermuth.wordpress.com/2007/12/01/conditional-column-formatting-in-apex/

but now as the view gets selected from a select list the query is dynamic:

DECLARE

v_query varchar2(1000);

l_table_name varchar2(30) := :P1_DBNAME ||'_PERFORMANCE' ;

BEGIN

v_query := 'select TIME,                                       

ELAPSED_TIME,                                  

case when ELAPSED_TIME < (Select SECS from DASHBOARD_PERF where DBNAME=:P1_DBNAME) then ''green''

          when ELAPSED_TIME >= (Select SECS from DASHBOARD_PERF where DBNAME=:P1_DBNAME) then ''red''

       end the_color 

from '||l_table_name;

return(v_query);

END;

One new column of the_color is created in the report but when I did the following:

Report Attributes > Column Attributes for “COL01” > Column Formatting > HTML Expression

<span style="color:#THE_COLOR#;">#COL01#</span>

There is no change in font color .

Is it becuase my query is dynamic?

Cna you please suggest me how do it?

will i have to make a dynamic action and execute some javascript code in it?

I am bad at javascript coding

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 14 2016
Added on Aug 17 2016
1 comment
1,475 views