Home > Forum > Actions > Column coloring with SQL conditions in Item List

Column coloring with SQL conditions in Item List
0

Hello all,

I have an item list where I want to display some column color based on the value that will be the outcome of 2 dates.

I would like something like if it's zero, the column should be green, if it's between 0 and 30 days, it should be yellow and if more than 31 days, it should be red.

I'm trying to use this, but it's not working:
if ('{SFD:-4}' = 0)
select '#90EE90'
if ('{SFD:-4}' > 0 or '{SFD:-4}' <= 30)
select '#FFFACD'
else ('{SFD:-4}' > =31)
select '#FF6347'

I've also tried with elseif but it's not working.
Does anyone know how to make this work?
Thank you

In reply to: Martin Meze (Freelancer)

Hi Andreia,

Did you try with SELECT CASE WHEN ... THEN ... ?

Hi,

Using the else if, it gives an exemption error in the system.
I've switched for case when

(select
case when '{SFD:640}' =0 then '#90EE90'
when '{SFD:640}' <= 30 or '{SFD:640}' > 0 then '#FFFACD'
else '#FF6347'
end)

But it's giving an error of no column specified for nn. I've switched to objects tab and added the From but it's not working as well.

Do you have any thoughts?
THank you for the help!

Privacy overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.


To see a full list of the cookies we use and learn more about their purposes, visit our Privacy Policy.