Add to correct table with button

Hi everyone!

Is there a way to add a value to a table with a button on condition? This is a simple example of what I’m trying to do:

Note: I know filters would work, but it doesn’t in this situation. I really need to create a row in the correct table.

Any help is truly appreciated :slight_smile:

Hello @Jay_Lefebvre,

One simple way to do this is with an IF() switch in the formula of the button:
If(thisRow.Names=“Alexa”,AddRow([Alexa’s Table],Score,thisRow.Score),AddRow([Gabriel’s Table],Score,thisRow.Score))
image

However, this is somewhat clunky and breaks down fairly quickly as you add more people/tables.

For most use cases it is better to simply have one table and use views of that table that filter by person - out of curiosity, why do you need multiple tables?

Thanks!

Oh I see! @Bobby_Ritter

What would the formula look like if there was three names? Does the IF fonction only work with two names since it’s true or false?

I need multiple tables because new rows will be triggers for Integromat/Zapier automation. Each name creates a different automation.

Thanks for your time :pray:

Ahh, makes sense - so your only choice is to either split the logic inside Coda or would need if/switch statements in Zapier/Integromat

You can use Switch() instead then:
=Switch(Names,“Alexa”, AddRow([Alexa’s Table],Score,thisRow.Score),“Gabriel”, AddRow([Gabriel’s Table],Score,thisRow.Score),“Rita”, AddRow([Rita’s Table],Score,thisRow.Score))

@Bobby_Ritter Seems to be working for Alexa but not the others… I updated the example above and added Rita.

Thanks

Looks like your parentheses were a bit off - try this, thanks!

1 Like

Thanks this works perfectly, thank you!

@Bobby_Ritter Sorry to bother you again, I’m trying to use the same kind of formula to delete rows instead of adding rows. I found a way to delete all rows of a table, but it doesn’t seem to work when deleting a specific row. Here’s what I did:

Again, thank you for your time, this is a game changer :laughing:

Hello @Jay_Lefebvre,

You were quite close, the reason it wasn;t working for you becasue you were selecting a list to compare thisRow.Hello to as opposed to a column that is part of the table:

Review this:
image

vs this (which I just tested to work):
image

And particually pay attention to the symbols after the "Hello"s, you’ll see that by trying to filter based on a list matching with an indivisual property, it wasn’t working, thanks!

1 Like

Thank you so much this is AWESOME!

1 Like