Skip to main content
All CollectionsFormulasSpecific formulas
Reference current rows in formulas with thisRow

Reference current rows in formulas with thisRow

Understand what thisRow means in formulas and when to use it

Updated this week

In Coda, the smallest unit is actually the row - not the individual cells like you might find in Excel or Sheets. Each row is packed with all the essential details found in its columns, making it super convenient. By using thisRow in formulas, you can easily zero in on a particular row from a column to carry out a function.

Within this article, you’ll find...


Understanding thisRow

In Coda formulas, thisRow is a way to programmatically refer to the current row in a table. This can especially come in handy when you’re using formulas to calculate column values. Let’s dive deeper with an example.

Imagine you have a table of tasks, and each task has a due date. But you hate doing math, so you want to add a column that automatically tells you how many days away the due date is for each row. To achieve this, you would create a column formula with the following structure: thisRow.DueDate - today() . This formula is essentially saying: for each row in the table, take the Due Date column value and subtract today’s date in order to give me the difference in days. Without thisRow, you couldn’t get a dynamic value that changes for each row depending on the other data in the row.

You can see this formula in action in the image below.

16_10 (83).png

Use thisRow with relation columns

Aside from using thisRow within a single table as demonstrated above, a great way to use it is within the context of relation columns. Relation columns allow you to connect two separate tables. Let’s look at another example.

You have a Tasks table, and a Projects table.

In your Tasks table, you add a relation column (named Project) which references your Project table. You use this to assign the associated project for each task.

Once you've added an Assignee value to a row, you're able to access any other data from the Team table associated with the selected Assignee with a very simple formula:

thisRow.Project.[insert any column name value from Project table]

thisRow with relation example.gif

For example, thisRow.Project.EndDate pulls in the End Date value for the current row’s project from the Project table, and thisRow.Project.Description pulls in the description from the Project table.

Use thisRow as a row reference

You can also use thisRow as an entire row reference in some instances. As an example, you can see this clearly in a linked relation. When you create a linked relation, Coda will automatically generate a formula “behind the scenes” to help set this up. If you take a look at the formula, you can see how Coda uses the Filter() formula and thisRow to create the linked relation.

16_10 (84).png

In the example image above, the Q4 Tasks table has a relation column connected to Q4 Projects. The values in the Project column are “chips” to indicate that they are entire row references rather than plain text values.

In the Q4 Projects table, the Tasks column is a linked relation column that uses a formula to compare the Project values in Q4 Tasks, which are row references, back to the values in this table (Q4 Projects), as designated by thisRow.

❓ Why not thisRow.Project?

thisRow.Project pulls the data in the Project column for a given show, and therefore gives us the plain text value of the Project name. This plain text value is not a direct comparison to the row references in the Project column in Q4 Tasks.

In the formula above, note the “row” icon in the green Project chip, and the “row” icon in thisRow. This notes that the value types are the same, and the formula can directly compare the values in the Project column of Q4 Tasks and the rows in the Q4 Projects tables.

thisRow.Project is a Text value, as noted by the “T” icon. If used in this formula, we would not surface the correct results:

16_9 (25).png


Related resources

Did this answer your question?