When you're working with a set of data, many times you're looking to pull out a specific subset of it -- like the first item of a list, or the last 5 rows of a table. Here's where Coda's First, Last, Nth, and Slice formulas come into play saving you time and getting you the data you need.
For example, imagine you had a simple list of numbers: [1, 3, 5, 7, 11, 13]. Using these formulas, you can pull out specific items from the list based on their position. We've summarized these formulas in a table below:
Ways to use Slice
With Slice in particular, there are a few different varieties you can try:
Give me the first 3:
=List(1,3,5,7,11,13).Slice(1,3)
1,3,5
Or, give me the last 2:
=List(1,3,5,7,11,13).Slice(-2)
11,13
And even, pull out specific rows:
Let's say I was working with the Urgent Open Tasks table in our Product Launch Hub, and I wanted to get the last 3 rows of this table which are sorted by their End Date:
Using Slice here let's me work off of the formatting I've already built for myself in the core project table:
=[Urgent Open Tasks !!].Sort(True, End).Slice(-3)