Zebra Pattern in sorted or filtered tables

Hi, is there a way to access the line number of a filtered list?
i want to apply a zebra pattern to the rows and dont want to loose it if the list gets sorted

Hi @AudaZ_Fernando_Sudicovich,
welcome to coda Community.

There is a way to achieve that, though it implies some easy formulas and a an assumption.

  1. You add a column (e.g. Rank) with the - well… - rank of your row inside the table with this formula: Rank(thisRow,thisTable)
  2. You sort the table by this Rank column
  3. You set a conditional formatting to odd/even rows with the formula Rank.isOdd()

The assumption is obviously that the zebra effect works as long as you keep the Rank sorted. I.e. changing sorting would potentially mess the alternation.

I hope it helps.

My bad: I didn’t carefully read this (and in the title as well…)
I don’t delete my post (maybe it’s useful for someone else), but definitely isn’t helping you.
:frowning:

Hi @AudaZ_Fernando_Sudicovich,

Welcome!

I think the trick here is that the formula needs to include the same sort and filter as the overall table. You can check the second example here and the “Sort Direction” column, which will keep the sort order and row number consistent.

This would be the type of formula you’re looking for and you could substitute in canvas control values for things like filtering…

thisTable.Filter(Category!="Numbers").Sort(false,thisTable.RowID).Find(thisRow)

This is assuming I have the table filter for not equal to numbers and the table is sorted by a column called RowID.

Hey @AudaZ_Fernando_Sudicovich!

Curious if this is what you’re looking for?

Here’s the solution you’re looking for, with all the details.

You cannot get the currently visible row that would respect sorting (or filtering if it’s a master table and not a view), but you can sort with external controls and use their value to also calculate row position.

1 Like