I’m trying to create a button that creates multiple rows based on 2 different columns.
I know how to get a button to create multiple rows normally. However, I have the following situation:
Create a new row for each user in the row AND
Create a new row for each option from a list
So the result would be a row for each users for each option that is in a list. For example, if I have 3 users on a task, and 2 options selected, there would be 6 rows created when the button is clicked. 3 Users each with 2 Rows of Options.
I couldn’t get the formulas I tried to work when I tried Sequence(), FormulaMap(), and/or RunActions(). Hoping one of you Coda geniuses can help.
You’re on the right track with an add-to-feedback button in each row (and then if you want, you can click all of those buttons with one button outside the table).
The challenge you may have encountered is having multiple FormulaMap()s. You need a FormulaMap() for each column, but then what does currentValue mean when you’re 2 levels deep?
The solution Coda designed for this is WithName()
WithName lets you give something a new name - for example, giving currentValue a name so that you can still reference it from within another layer of FormulaMap() depth
TeamMember, // The name we're choosing for the current team member in the formulamap
Imperative, // We don't really need to do this WithName, it just helps keep things more readable 6 months from now
... make the row in here, referencing TeamMember and Imperative...
For any users that read this in the future, below is the final code used in the playground doc.
I had some issues with the formula adding the Task Name in the Feedback Table - Task Name column each time a row was added. So in the example from my first post, you’d have 6 rows each with the Task Name listed 6 times.
I added .First() to fix the issue.
Also, had some issues finding the right syntax (missing value, parentheses, etc.)