Conditional Column Formatting in APEX


Tyler Muth's avatarTyler Muth's Blog

I wanted to share a little trick I’ve used in APEX for a while now to conditionally format report columns based on their values. I’m sure there are plenty of alternatives to this trick, including the 4 built-in conditional alternatives for a row when using a named column template.

At a high level, this technique uses the following components:

  1. A hidden column in the query that returns the formatting attributes for a column. I’m going to return the color or padding-left in my examples later in this post.
  2. Edit the Report Attributes > Column Attributes > Column Formatting > HTML Expression of a visible column and use the hidden column to change it’s formatting. This is the same section you apply a date or number format.

Example 1 – Color Code Salary

Query


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

Result
salary_color

Example 2 –…

View original post 17 more words

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.