Saving a "table" to a variable

I have a date based application, and events are added haphazardly, so it is very important for me to always sort by Date. Does it make sense for performance to create a sorted table that I can then reference everywhere.

For instance, if I have DB_Events (table), Can I just also create a Var_SortedEvents and use that everywhere and essentially never reference DB_Events. If so, is there a difference between setting Var_SortedEvents in the two following ways. Are there any limitations to either? Does anyone even do this?

(1) In the canvas just type “=DB_Events.Sort(true, DB_Events.Date)”, and then give that canvas formula the name Var_SortedEvents.

(2) Create a view by writing “/table” and select DB_Events, and then setting the sort setting in Table Options. Then naming the view Var_SortedEvents.

Hi N_G

as far as I have seen, there are no variables like that.

(In fact I have not noticed the concept of variables as known in other languages, although I have not looked for it. The closest would be selectors, or a column itself.)

But I am not certain that there is a performance impact here, unless you want to be able to have two views of the table that are sorted in different ways.

Creating a view from /table to your table does not create a new instance of the day, it is literally just a view of the table.

The only way that performance would be impacted, in my fairly new experience, is when a new entry is added to the table, to ensure that the table is still sorted. (From any view)

How many new entries do you make? How many entries in the table?

Hi @Piet_Strydom,

I just find I pull data from the DB_Events often and it always is a form of DB_Events.Filter([stuff]).Sort(true, DB_Events.Date). I believe i wouldn’t need to keep repeating that sort function if I created either version of Var_SortedEvents and then just referenced that list of rows instead of DB_Events. So all my formulas will now say Var_SortedEvents.Filter([stuff]) instead of DB_Events.Filter([stuff]).Sort(true, DB_Events.Date).

If I have a column in a 1000 row table that does DB_Events.Filter([stuff]).Sort(true, DB_Events.Date), will it be sorting the table for each of the 1000s rows? So wouldn’t if be better if I had the column equal Var_SortedEvents.Filter([stuff]) so then it doesn’t have to re-sort.

My main hesitations to doing this is I’m not sure that it always honors a views sort/filter when you reference it, and am also concerned that another author of the Coda doc would accidently modify that view not realizing why I have it the way I do (therefore naming the view Var_SortedTable, so then the Var denotes that it is set the way it is for a reason and shouldn’t be changed).

We use this coda doc daily, and in the 14 weeks since its launch we have two date based tables, one receives 25 events a week, the other 50 a week. At the moment we have 350 and 750 events.