What to do when CurrentValue is overloaded

Let’s say I have a FormulaMap() of a list. And within that formula map, for each item, I want to AddRow(). But then, within that Row, I want to refer to the CurrentValue I’m working with in formula map. However, when I use CurrentValue, Coda only seems to let me refer to the current value from the row, instead of the current value from the formula map. Is there a way to show WHICH list I’m referring to with CurrentValue?

Here’s a picture of the issue:
image

2 Likes

That’s a know thing:

There’s a workaround with storing the outer CurrentValue in a cell somewhere (e.g. same row dedicated column, or a helper table).
E.g. here’s the way I’m iterating over Value Drivers, then each of their Metric Uplifts, then for each of those I insert six rows with a Sequence().FormulaMap(). Note how I store _Current Value Driver and _Current Metric Uplift into a cell before using it in a nested FormulaMap:
image

(Fun fact: in retrospective, in my case none of this temporary cell saving was needed :slight_smile: I could rewrite the formula without it )


However, in your case CurrentValue is in fact a row from Habits to condition with. It’s a bug with formula editor that incorrectly treats it as if from Messages 2 table. See:

2 Likes

Thanks Paul, your knowledge of Coda is truly amazing (have they considered hiring you yet?)

Does this mean that there’s a way to refer to a property of the current value even though the editor is broken? If the habit to condition has a property called “Accountability Buddy User” that’s a User, how do I refer to that given the bug in the editor?

You can use the _Deref(CurrentValue, HabitsTable.RequiredColumn) to get to the value you need. Or use the “storing to temporary cell” trick. The former is faster to do but uses a hidden formula that may break at some time in the future.

And thanks. And I don’t know, maybe they did consider hiring me, but I’m located far away :upside_down_face: I’m doing my own thing with Coda though, paid consulting and doc building for hire. They did many nice things for me though, like drew me this maker-style avatar or a logo for my upcoming blog.

1 Like

Have any other solutions to this come to light since this thread was created, @Paul_Danyliuk?

The bulletproof solution is described here (basically the answer above expanded as a tutorial)

If you need a column formula, not an action — one way is to construct a full product of [outer CurrentValue, inner CurrentValue] pairs, then iterate over that. Example:

As for the original question, this should now be fixed. It was an editor bug.

3 Likes