Hey Coda, I’m going to give you a long formula. I’ll probably want to use it later, so can you remember that formula by a sweet little nickname I give it?
WithName() uses three parameters:
Value
WithName(Value, Name, Expression)
The value you want to rename (usually a short forumula).
Name
WithName(Value, Name, Expression)
The name you want to give the value (i.e., the "sweet nickname".
Expression
WithName(Value, Name, Expression)
The primary formula--you use the renamed value in here.
What Exactly Is This Formula?
WithName() is like the bit.ly of Coda. The mnemonic device of Coda.
Bit.ly
Takes long and complex URLs and shortens them
Mnemonic Devices
Takes long and complex phrases and creates a way to memorize them easily
withName()
Takes long and complex formulas and allows you to reference them easily
How Does it Work?
Here’s a quick example. Let’s say that I want to draft a sentence that tells me how many people in the
WithName() does require extra keystrokes and admittedly does have a small learning curve. So when and where should you use it to actually provide value to your workflows or docs?
First off—if you are writing a longer formula that utilizes filter() within a formulaMap() you will need to use withName() to access the currentValue (see
lesson for more info on current value) within the ForEach() loop.
Example
Let’s say you wanted to write a canvas-based formula to draft a summary list of the amount of people that match a certain age and let their names be instantly clickable in order to pull up their information.
You will need to use withName() to do that.
Here’s the formula (Right click to see how its written)
There are 2 people that match the age of 20
@Craig Kidd
@Mr. Brian Montoya
There are no people that match the age of 21
There are 3 people that match the age of 22
@Bryan Johnson
@Jackson Fron
@Angie Collier
There are 3 people that match the age of 23
@Megan Smith
@Daniel Ayers
@Coda Man
There are 3 people that match the age of 24
@Ronnie Gross
@Thomas Ward
@Scott Weir
There is 1 people that match the age of 25
@Elizabeth Nguyen
There is 1 people that match the age of 26
@Angela Hill
There are no people that match the age of 27
There are no people that match the age of 28
There is 1 people that match the age of 29
@Matthew Smith
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Name
Age
Name
Age
Craig Kidd
20
Elizabeth Nguyen
25
Ronnie Gross
24
Bryan Johnson
22
Angela Hill
26
Matthew Smith
29
Thomas Ward
24
Megan Smith
23
Mr. Brian Montoya
20
Daniel Ayers
23
Scott Weir
24
Coda Man
23
Jackson Fron
22
Angie Collier
22
There are no rows in this table
Practice: Use WithName() in a simple formula
Done
Create a “Learn about a tree” activity
Done
Challenge: Create a summary of salary information for a dashboard
Done
Want to print your doc? This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (