How to prevent coda to look for a row if it currently doesn't exist?

I know it might be a bit hart to understand what is exactly happening in this formula because it is a bit complex behind what you will see, but I will explain the main problem I have.

I have a button with the formula shown further down (screenshot 2), but I can’t click on the button because I get this error:

image

And the reason it wasn’t able to find “Row ID or UID” in SecondtoLastParent is because the SecondtoLastParent currently doesn’t exist. There is currently only one parent row so there is no second one, therefore the second to last one doesn’t exist.

I would like to bypass this issue when there is no SecondtoLastParent, in order to be able to execute button’s actions even when Coda can’t find this row.

As you can see in the picture below, I tried bypassing the issue by using the if function:
If([SecondtoLastParent].isNotBlank,...
Hoping that if it outputs false, it wouldn’t look for SecontoLastParent’s Row ID or UID and would keep executing remaining actions. But that’s not what happened. It is stuck on the fact that this row doesn’t exist.

How do I make Coda ignore this error when it happens?

Hey Fran, thanks for reaching out! I like to use SwitchIf() to circumvent a path with a value that sometimes doesn’t exist. SwitchIf() stops evaluating after the first true condition is found, unlike If() which evaluates both conditions and will break if either formula path fails.

The SwitchIf() workaround would look like this:
SwitchIf( SecondtoLastParent.IsBlank(), _noop(), [your arg here] ).

Try that out and let me know if that works for you. If not, can you tell me a little bit more about your use case? What is this formula set up to do?