Nested conditional on formula

Is it possible to have nested or multiple possible outputs in formulas in some way?

I want to create an indicator if a task was created over 30 days ago and does not have a “Final” checked state, by setting a text field to an emote.

Additionally, I want to have a different symbol, or both if possible, if it has due date and it is in less than 7 days.

Right now they’re only one and the same through an or in the condition. It will display icon if either is true, and nothing if it doesn’t have due date or conditions are not met.

If(
	(
		(ToDays(Today() - [Creation Date]) > 30)
		and
		(State.Final = false)
	) or (
		(ToDays([Due date] - Today()) > 0)
		and
		(ToDays([Due date] - Today()) < 7)
		and
		(State.Final = false)
	),
	"⚠",
	""
)

I imagine it will be fairly easy to achieve if/when string concatenation becomes available in the formula field, but for the time being it’s certainly possible to nest ‘if’ functions:
If(Cond1,“A”,If(Cond2,“B”,“C”))
Using that method, you could write conditional logic to achieve what you’re describing (as far as I understand you).

1 Like

Concatenation is a great type of formula. Things like a Contact, where you could have one field for “Full Name,” and that would generate based on two other fields: “First Name” and “Last Name”

Great Suggestion!

Hi, Martin!

Here is how your formula will look like :slight_smile:

If(
    (((ToDays(Today() - [Creation Date]) > 30) and (State.Final = false)) and (ToDays([Due date] - Today()) > 0)) and (ToDays([Due date] - Today()) < 7),
    "💩🚨",
    If((ToDays(Today() - [Creation Date]) > 30) and (State.Final = false),
        "💩",
        If(((ToDays([Due date] - Today()) > 0) and (ToDays([Due date] - Today()) < 7)) and (State.Final = false),
           "🚨",
           "🤗"
         )
    )
)

It’s now a whole lot easier thanks to concatenation in formulas :slight_smile:

If( (ToDays(Today() - [Creation Date]) > 30) and (State.Final = false) ),“:balloon:”,“”) + if ( (ToDays([Due date] - Today()) > 0) and (ToDays([Due date] - Today()) < 7) ),“:soccer:”,“”)

2 Likes

Definitely!
Also glad it is here :face_with_monocle::sparkles: