# Why Doesn't This Formula Work?

**URL:** <https://connect.superhuman.com/t/why-doesnt-this-formula-work/23169>\
**Category:** Bugs\
**Created:** [April 29, 2021, 9:41pm UTC](https://connect.superhuman.com/t/why-doesnt-this-formula-work/23169 "2021-04-29T21:41:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cnr](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/cnr/32/24174_2.png) [@cnr](https://connect.superhuman.com/u/cnr)\
**Post date:** [April 29, 2021, 9:41pm UTC](https://connect.superhuman.com/t/why-doesnt-this-formula-work/23169/1 "2021-04-29T21:41:58Z")

</div>

Formula is:

```auto
WithName(
  AddRow([Table 1]),
  newrow,
  [lookup table 2]
    .ModifyRows(
      [Table 2].[Table 1 Inputs],
      If(
        [lookup table 2].[Table 1 Inputs].IsBlank(),
        newrow,
        [lookup table 2].[Table 1 Inputs].ListCombine(newrow)
      )
    )
)

```

It may be related to

> [@withName row variables cannot access column values in certain cases](https://connect.superhuman.com/t/withname-row-variables-cannot-access-column-values-in-certain-cases/22882):
>
> Not sure if this is a bug, but it seems that named variables (via withName), at least in some cases, cannot have members referenced. For example given a table “Some Table” that has a Name column: withName([Some Table].First(), first\_row, first\_row.Name) …fails at runtime as Name column cannot be found on the row, for some reason. Thank you! [UPDATE] View below thread and coda doc bug example with RunActions.

and `WithName()` bugs

@Jason-Tamulonis, is this expected behavior?

https://coda.io/embed/a-2kaFAS1S/_suv2z?viewMode=embedplay

---

<div class="post-metadata">

**Author:** ![Federico\_Stefanato](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/federico_stefanato/32/10092_2.png) [@Federico\_Stefanato](https://connect.superhuman.com/u/Federico_Stefanato)\
**Post date:** [April 30, 2021, 8:54am UTC](https://connect.superhuman.com/t/why-doesnt-this-formula-work/23169/2 "2021-04-30T08:54:44Z")

</div>

Hi @cnr ,  
Interesting case, but I’m not sure I completely understood it.  
What is your purpose?

You say:

> [@](#):
>
> I’m trying to add a new row to [Table 1] and then to add that row to the column **Table 1 Inputs** in [Table 2]

However, `AddRow()` formula returns an `Action`, not a row (\*).

Therefore I expect that the _quirky_ behaviour is due to the fact that the first time it adds the full row by guessing the data inference taking the origin of this action.

Let’s say that I’d expect an error, in this case, as we are comparing `Action` and `Row` (`Ref`) objects, but  
I’d not consider it a bug (more on this from @Jason-Tamulonis and other @codans, I hope)

Also, I think it’s not related with the `WithName()` bug (now fixed): that was a due to a referential context not passed to `RunActions()` within `WithName()`.

**Edit**.  
In the document I provided an example of how to refer to a newly created row.  
I’m sure @Paul_Danyliuk (guess who… 🙂 ) fully explained about it but I cannot find the original post.  
It is a typical use-case of opening the detail of a newly created row in a different table.  
It still relies however on the “forced” way to create a row from an action, though.

(\*)  
As said sometimes in the past, I would open this topic.  
I think that returning the _subject_ of the _action_ - rather than the actions itself - would be more useful and intuitive, as you pointed out with this post.  
So add/modify/delete row should return the affected row(s) by simplifying significantly the logic of some typical use-cases.  
Happy to discuss more about it.

---

<div class="post-metadata">

**Author:** ![Jason-Tamulonis](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/jason-tamulonis/32/46956_2.png) [@Jason-Tamulonis](https://connect.superhuman.com/u/Jason-Tamulonis)\
**Post date:** [May 4, 2021, 10:39pm UTC](https://connect.superhuman.com/t/why-doesnt-this-formula-work/23169/3 "2021-05-04T22:39:53Z")

</div>

> [@Federico\_Stefanato](#):
>
> However, `AddRow()` formula returns an `Action` , not a row (\*).

@Federico_Stefanato This is a good explanation. We have discussed potentially changing this for WithName, but we have not had the bandwidth to get to it yet. We will have to spend some time thinking about if this could break existing workflows.

Turning the question around to the community. Are there places where changing this behavior would break existing flows? Do you feel like changing the behavior would be a better user experience?

---

<div class="post-metadata">

**Author:** ![cnr](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/cnr/32/24174_2.png) [@cnr](https://connect.superhuman.com/u/cnr)\
**Post date:** [May 5, 2021, 2:57am UTC](https://connect.superhuman.com/t/why-doesnt-this-formula-work/23169/4 "2021-05-05T02:57:06Z")

</div>

Thank you for your response!

Is there even a way to call an action if it’s in a table? Can I add actions to various rows in a table and then call `RunActions` on them?

Also, isn’t it fairly inconsistent right now? For some reason the first `AddRow`is executed and then the second one is not? I would understand if it were both or neither, but as it stands it seems unpredictable.

---

<div class="post-metadata">

**Author:** ![Federico\_Stefanato](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/federico_stefanato/32/10092_2.png) [@Federico\_Stefanato](https://connect.superhuman.com/u/Federico_Stefanato)\
**Post date:** [May 5, 2021, 2:00pm UTC](https://connect.superhuman.com/t/why-doesnt-this-formula-work/23169/5 "2021-05-05T14:00:58Z")

</div>

> [@cnr](#):
>
> Also, isn’t it fairly inconsistent right now? For some reason the first `AddRow` is executed and then the second one is not? I would understand if it were both or neither, but as it stands it seems unpredictable.

Yes, this is my opinion as well.

> [@Federico\_Stefanato](#):
>
> Let’s say that I’d expect an error, in this case, as we are comparing `Action` and `Row` ( `Ref` ) objects,

I’ll try to extrapolate the topic to a new one and see how the community would see it.

---

<div class="post-metadata">

**Author:** ![Federico\_Stefanato](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/federico_stefanato/32/10092_2.png) [@Federico\_Stefanato](https://connect.superhuman.com/u/Federico_Stefanato)\
**Post date:** [May 5, 2021, 2:45pm UTC](https://connect.superhuman.com/t/why-doesnt-this-formula-work/23169/6 "2021-05-05T14:45:31Z")

</div>

Please, follow here:

> [@\[Open discussion\]: What an action (add, delete, modify) should return?](https://connect.superhuman.com/t/open-discussion-what-an-action-add-delete-modify-should-return/23254):
>
> Hi everybody. The discussion started here ([Why Doesn't This Formula Work?](https://connect.superhuman.com/t/why-doesnt-this-formula-work/23169) by @Connor_McCormick and followed by @Jason_Tamulonis ), but perhaps it’s a good thing to give full visibility to a topic I consider an interesting point. Have you ever had the need to refer to a just created/modified/deleted row(s)? As of now, functions [AddRow()](https://coda.io/formulas#AddRow), [AddOrModifyRows()](https://coda.io/formulas#AddOrModifyRows), [ModifyRows()](https://coda.io/formulas#ModifyRows) and [DeleteRows()](https://coda.io/formulas#DeleteRows) return (output) an Action that - when run - will affect the selected rows. My current perception is actually…
