Row number detection

I cannot find a way to detect the row number in a table. I understand I can have a Row ID, but I would like to be able to detect the actual row number in a table.
In my specific case, I am trying to recreate the age old Excel odd/even row styling, but I am sure there are many other uses for detecting the row number.

Any help would be appreciated.

1 Like

Dear @David_Clegg

This post might help you forward

When searching for RowId in the community, you will find many more posts that might of your interest.

Kind regards,
//JP

1 Like

To find the visual position of the row:

thisTable.Find(thisRow)

6 Likes

I am new to coding and formulas…

What’s a difference between:
thisTable.find(thisRow)
and
find(thisRow,thisTable)

How does a computer approach each formula?

Also, I don’t understand how is an output a row number, and not row title or whatever other column is set as display column. In other words: How does it know to look for exactly that value and not some other value inside thisRow. Is it set as default?

Dear @Fran_Vidicek

The display column in a table, is where the core (unique) information is stored, others are the related attributes

In Coda is “The concept of chaining:”, the preferred way to go

For your kind reference, more details you will be able to find in the article below:

2 Likes

None (AFAIK) :blush: … At least, it will give you the same result …

The chaining method used here :point_right: thisTable.find(thisRow) is just another way of writing this : find(thisRow,thisTable) :blush: .

The big advantage for me of chaining is readability (especially later, when you get back to a doc you didn’t open for a while). Plus, it simply feels more logical and natural :blush:

In this case, this is simply because that’s what Find() outputs/returns :blush: : a position as a number …

So, in other words, with this formula:

thisTable.find(thisRow)

You actually get as a result the position of thisRow in the table :blush: (which different than the RowID set on Coda’s side)

Well, a table is just a list of rows and each row in a table has a Reference which is always the value from your Display column. (The display column always exist in a table, it can’t be avoided… Even if you have only one field (as by default, this would be the Display column))

The Reference of a row is that specific value allowing you to access all the other values stored in the various fields of your table for that specific row :blush:

When you use thisRow alone (as in thisTable.find(thisRow)), you get the reference of this row in a table.

Now, if you chain it with something else :

E.g.: thisRow.Name

You’re actually accessing the value stored in the field Name for this specific row :blush: (which is here a text value)

The explanations here might not cover everything about the subject though :blush:

Add-on: This video from the Great Wizard @Paul_Danyliuk might interest you (generally speaking :blush:)

3 Likes