CurrentValue
in loops such as Filter and FormulaMap/ForEach is a pain to use because we have to use WithName
to be able to access the current value of a parent loop:
Table A.Filter(
CurrentValue.WithName(
ParentCurrentValue,
Table B.Filter(
CurrentValue.Prop=ParentCurrentValue.Prop
)
)
)
While the above example doesn’t make much sense and is just for illustration, there are many times I find myself trying to access a parent current value.
My suggestion is to add a new named or optional argument (so existing formulas are not broken everywhere) which can be used to set a custom name for the current value, something like: ForEach(List, CurrentValueName, Formula)
, and so the above example would become:
Table A.Filter(
CurrentTableARow,
Table B.Filter(
CurrentValue.Prop=CurrentTableARow.Prop
)
)
With one level of nesting the difference is not very visible, but Coda formulas are already very verbose and any nesting that can be avoided is a “quality of life” improvement.