Anyone know how to limit the number of items returned by .bulletedlist()
?
I have a list of records in a table but on a separate page with the date they were created. I want to only list a summary of the last 5 that were added. I can’t seem to figure out how to limit the output of the bulleted list function. Any ideas?
I’m not a really great Coda formula expert by any stretch, but I suspect you can simply extend your formula by adding a .Filter() method to the end of the bull list.
I think you want to limit the input, not the output, eh?
Yea, I’ve been thinking Filter would be the answer but filter by what? I have a date field so is there a way to find out which are the 5 recent entries and only display those?
Yea, limit the input into the bulleted list function or just truncate the output of it. Either would work for me I think.
Awesome! That helped. Never used slice()
before but got me exactly what I needed! Thanks @Jean_Pierre_Traets!
@Sean_Kennedy, can you share the formula that solved this for you? Just a screenshot will do.
@Bill_French Sure!
For my use case it looks like this:
[Table].[Column].Slice([Table].Count()-4,[Table].Count()).Sort(false).NumberedList()
This listed the 5 most recent rows in my table and listed them in DESC order.
The meat of it is Slice([Table].Count()-4,[Table].Count())
where you Slice the table and include those from total rows minus 4 to total row count.
So if you had 20 rows, this would be 20-4=16.
Following the example of 20 rows, Slice([Table].Count()-4,[Table].Count())
is saying start at row 16 and end at row 20 (total row count) and that gives you the 5 latest.
I then added in a sort and numbered list function to list them out.
Make sense?
1 Like