CurrentValue in a an AddRow() in a FormulaMap()

Hi All,

I am trying out FormulaMap() and CurrentValue to get a better understanding.

My setup is like this: A table with numbers 1 to 5 in a column, and descriptions One to Five in a second column.
Then I use a button with formulaMap and AddRow to copy Odd number to a table called Odd, and Even numbers to a table called Even.

I have it working for the display column, but I am not getting the second column added to the AddRow formula.

Can Somebody please help?

On this page:

Regards
Piet

Hi @Piet_Strydom !

That’s because you are iterating on Numbers.Number and not directly on Number. So FormulaMap is looping over each number from each row but not the whole row, and thus CurrentValue represents the current number and not the current row, so you don’t have access to the Description column.

Your formula should start with :

FormulaMap(Numbers ………

You can then access the current number via CurrentValue.Number and the description via CurrentValue.Description. Or simply typing Number and Description.

3 Likes

Wonderful!

Got it.

Thanks
Piet

2 Likes

its hard to see it. but the clue is the tiny 123 icon on the CurrentValue - that shows that it is a single numeric value.

my retina seems to effeciently filter out all those little icons that the codans went to so much trouple to provide. but whenever i have unexpected results, i put on my stronger glasses and look closely at those icons and they usually add lots more information about what coda thinks is going on.

well spotted, @Martin_Portevin, you hit the nail on the thumb, or whatever the expression is

max

3 Likes

I still struggle with the icons, and the meanings behind them. I think I am getting there with not comparing a single value with a list, but this one is a new dimension.

Maybe time to do some research and document it for myself once and for all.

P

1 Like

Please hit it on the nail… and not the fingernail…

1 Like

Hit the nail on the head :wink:

But yes - those chips are crucial to understanding Codas formula language and working with it properly.

Both value types AND whether or not that value is a single value Vs. A list are contained in a chip.

Then the color of the chip is an indication of its source

Luckily @maria just broke it down!

4 Likes

So glad this was helpful!

2 Likes