Update cell value formula help

Hi all, brand new to Coda here so please forgive the beginner questions! I’m playing around with a home organization app and could use some advice as I get acclimated to the Coda language. I’m tracking the arrival of certain furniture which has come in numerous shipments per each part. What I want to do is manually select the Arrived option and if it meets the Expected column, the Status is automatically changed to one of a few options I have. The formula is erroring out due to circular references - not denying it, but I’m not yet aware of how to adjust.

Attempted to search around, so if this has been asked I do apologize! :bowing_man:

Welcome to Coda!

Your if statement has three parts: the condition, the value returned if true, and the value returned if false.

Your mistake is that you’re trying to use the “equal sign” operator in two different ways:

  • In the conditional, you’re using it to determine if two values (arrived and expected) are equal. This is the correct usage of the operator in Coda’s syntax.
  • In the true / false outcomes, however, I think you’re trying to use it to update the value of Status. In Coda’s syntax, the equal operator is only used to test equality, not to set values!

Since you’re formula is setting the values for each cell in the Status column, you don’t need to “tell” Coda to set the Status value – you can just return the values you’d expect and Coda will calculate your formula for each row in the column accordingly.

Said another way, try this:

if(
  thisRow.Arrived=thisRow.Expected,
  Arrived,
  Partial
) 

And that should do the trick!

Wow, thank you Christian for the speedy response and the welcoming! I tried that, no dice. I think since Arrived and Partial are options in the Status Legend table I have beneath, the formula isn’t working. My guess is I’m not telling Coda correctly how to find the value contained in the Status Legend table.

RESOLVED: @kennymendes was able to help me through it. Coda’s formula can reference the values in my legend table if I call it as a string. The working formula was simply missing quotes :today-i-learned:

if(thisRow.[Arrived?]=thisRow.Expected, "Arrived", "Partial")

Hey there!

From your original post, if you want to reference the lookup value (which you have stored in another table) you could also try this:

  • Instead of typing “arrived”
  • Start typing @arrived and the row reference value should appear, allowing you to reference the table

Oh, very interesting!

Meaning the formula would be like:

if(thisRow.[Arrived?]=thisRow.Expected, @arrived, @Partial)

?

I didn’t read through the formula specifically, but YES!

You are essentially calling the row reference with the @tag in a formula like you can do anywhere else in Coda

The important thing to note is that you won’t actually end up with @arrived – when you type @ it’ll kick off an autocomplete, then you’d check the “arrived” object from the corresponding table or select list.

1 Like

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