Is there an "IfEmpty" formula?

Hi guys, I’m new to Coda, but from what I’ve seen it really looks like an amazing tool. I would like to build an automation that checks if a file has been uploaded to a row, and changes the status of the row if it has indeed been uploaded (i.e it only changes if the file cell isn’t empty). I’ve looked at Coda documentation but I didn’t find any “IfEmpty” formula, I’ve tried with the “IfBlank” formula but it didn’t work.
How would you guys do this ?

Thanks in advance !

1 Like

Hi @guillaume_adragna and welcome to Coda!

The formulas you’re looking for are isBlank() and isNotBlank()

You can either put the thing you’re wondering about inside the brackets (like Excel):

isBlank(FileUpload)

or use dot chaining (a bit more readable imo, especially in more complex formulas):

FileUpload.isBlank()

For the exact situation you’re describing, you probably don’t need an automation. You can just set a formula on the column you want to be affected.

For example, if you want a checkbox column called “File has been uploaded” to react to file uploads, and you have a column called “File Upload” that the fiels are being uploaded to, you can set a formula on the checkbox column of:

If( FileUpload.isNotBlank(), True, False)

…which will check the box (“True”) if the file upload column has something in it, and uncheck the box (“false”) otherwise.

[Yes, yes, everyone - this can be collapsed to the more efficient FileUpload.isNotBlank(), but I think it’s useful to understand how the If() formula works early on]

3 Likes

Hi Nick, thanks a lot for the answer ! I’ve indeed tried with the IsBlank/IsNotBlank formulas, but it didn’t work either. Each time I try to use IsBlank, the output is “wrong”, i.e it outputs “false” even though there is no file in the cell.
In the image below, you can see that the formula outputs “true”, whereas my CE column (which is my file column) is completely empty.
Am I doing something wrong ?

Thanks again for your help !

Does this doc help explain things?

isBlank Example

(Visit link, hover on title in top-left, click 3-dot menu, “Copy” - that will give you edit access and allow you to see the formulas on the columns)

@guillaume_adragna, I believe part of your issue is that this needs to be evaluated on each row. The formula in your screenshot is evaluating a list of values, which may cause the IsNotBlank() function to not work as expected.

I have a similar automation that checks daily to see if a contract end date has passed or not, and if so, it marks the contract as expired.

This is a screenshot:

So what it’s doing is filtering the table to find all rows where the contract end date is before today, and for each of those rows, it’s changing the status to Expired.

I believe you could do this exact same thing:
[Missions 2023 overview].Filter(And([CE].IsNotBlank()=true, [Status]!=“File Uploaded”)).ForEach(ModifyRows([CurrentValue],[Status],“File Uploaded”))

Thanks a lot for the help Patrick ! I just don’t understand what is your “status” property in your formula…

Status was just an example of a column name. Yours will differ.

Would you mind explaining how the formula works ? I’m a bit confused…

Here’s my attempt to put the formula into English:

Filter the Missions 2023 overview table for rows that match the following criteria: the CE column is not blank AND the Status column is not equal to “File Uploaded” (that last part isn’t necessary, but will likely speed things up so that it’s not running ForEach on all the rows that have already had the Status set previously).

Now, For Each row returned by the above filter, set the Status field to “File Uploaded.”

1 Like

Ok great, I understand how you’ve created it, thanks a lot ! What exactly are the “ForEachRow” and “ModifyRows” formulas ? When I try to use them it isn’t recognized as a formula…