Right now, there’s a pattern I would like to be able to use with the If function that I cannot seem to do. The pattern is this:
Let’s say have a Variable I want to test with a conditional. For simplicity, let’s say
Variable = 1.
The way to test a conditional is with
If(Variable>0, true, false)
But I often want to invoke Coda’s special chaining like:
Variable.If(>0, true, false)
I’d also like to be able to return the value of the Variable with:
Variable.If(>0, Value, false)
This second part could be especially useful when Variable is something really convoluted like a long formula.
My pattern right now is:
If(ReallyLongFormula.isBlank(), ReallyLongFormula, "Some text")
Instead it could be:
ReallyLongFormula.If(Value.IsBlank(), Value, "Some text")
This might not seem like much, but imagine a formula like this needing to be used twice:
[Unit Actions].[Unit Type].Unique().FormulaMap(If(CurrentValue.In(Units.[Unique Unit Name].Unique()).Not(),CurrentValue,"-")).Split(",")
(btw, I may be using the attribute
Value wrong, and in that case just mentally replace it with a better name like
self or whatever)
You can’t do this with Filter() without using additional named variables, or if you can I don’t know how.