# Can the 'execute' property of pack.AddFormula addRow()?

**URL:** <https://connect.superhuman.com/t/can-the-execute-property-of-pack-addformula-addrow/27724>\
**Category:** Making Packs\
**Created:** [January 1, 2022, 9:58pm UTC](https://connect.superhuman.com/t/can-the-execute-property-of-pack-addformula-addrow/27724 "2022-01-01T21:58:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_McGreal](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/michael_mcgreal/32/5535_2.png) [@Michael\_McGreal](https://connect.superhuman.com/u/Michael_McGreal)\
**Post date:** [January 1, 2022, 9:58pm UTC](https://connect.superhuman.com/t/can-the-execute-property-of-pack-addformula-addrow/27724/1 "2022-01-01T21:58:45Z")

</div>

**Before packs:**  
In my table, I have a button that pushes other buttons in the same row (`runActions()`). Each child button in the row has some complicated formulas inside that will basically `AddRow()` using data from thisRow. Moreover, each child button’s AddRow() formulas are nearly identical, so if I modify one button, I then have to tediously modify the others. _(I attempted to consolidate them into 1 button using withName(), but it became even more complicated.)_

So now, I am attempting to consolidate all of this logic into one super button, powered by a Coda Pack formula.

**After packs:**  
In my pack formula, I set `isAction: true`, and Coda allows me to use the custom formula in my parent button! In the button formula editor, I can associate columns with formula parameters. However, inside the `execute` property of my `pack.AddFormula`, I cannot find a way to use AddRow() based on the parameter data.

Although, asking a formula to addRow() would probably require it to know the structure of the document. Maybe this could be achieved by prompting the user to create or associate the required tables/columns, but this sounds messy.

---

<div class="post-metadata">

**Author:** ![louca.developer](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/louca.developer/32/22685_2.png) [@louca.developer](https://connect.superhuman.com/u/louca.developer)\
**Post date:** [January 2, 2022, 8:39am UTC](https://connect.superhuman.com/t/can-the-execute-property-of-pack-addformula-addrow/27724/2 "2022-01-02T08:39:37Z")

</div>

Could your pack formula instead return an object (a mapping of columns to values adhering to the declared formula schema) that is passed to `AddRow()` which can create from this mapping a row in the table?

---

<div class="post-metadata">

**Author:** ![Michael\_McGreal](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/michael_mcgreal/32/5535_2.png) [@Michael\_McGreal](https://connect.superhuman.com/u/Michael_McGreal)\
**Post date:** [January 2, 2022, 7:51pm UTC](https://connect.superhuman.com/t/can-the-execute-property-of-pack-addformula-addrow/27724/3 "2022-01-02T19:51:42Z")

</div>

Hey @louca.developer that’s a clever idea! Thanks for pointing me in the right direction. I am finding other useful posts now that I have these keywords. I’ll try and let you know – thanks!

---

<div class="post-metadata">

**Author:** ![Eric\_Koleda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_koleda/32/50286_2.png) [@Eric\_Koleda](https://connect.superhuman.com/u/Eric_Koleda)\
**Post date:** [January 3, 2022, 2:19pm UTC](https://connect.superhuman.com/t/can-the-execute-property-of-pack-addformula-addrow/27724/4 "2022-01-03T14:19:52Z")

</div>

@louca.developer has the right idea. Just to clarify, the answer to your original question is no, Pack formulas cannot add rows directly. All Pack formulas can only take in data and return data. However these can be chained together with other native formulas, like `AddRow()`, to modify the document.

---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/system/32/24484_2.png) [@system](https://connect.superhuman.com/u/system)\
**Post date:** [January 7, 2022, 3:07pm UTC](https://connect.superhuman.com/t/can-the-execute-property-of-pack-addformula-addrow/27724/5 "2022-01-07T15:07:18Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
