A ranked number list repeated with data array

My app has some rank lists. I have added a list item that is repeated with my data array. I want to have ranked numbers started from 1 with consecutive numbers in the list.

I can use “INDEX_OF” to returns the first index to build the ranked numbers. But it crash the browser when I creat a long list repeated with my data array. And when i filter the list, the ranked numbers are not the right.

How should I do that?

Can you help? Thank you.

Hi there!

For this you could use the Formula functions MAP and SET_KEY by setting a numeric key for each object in the your list.

Something like this:
MAP<item, index>(items, SET_KEY(item,"numeric_index", index+1))

This would add a new key “numeric_index” in each object with a running number starting from 1.

Hope this helps!

Thank you for your help, and a Airtable question.

My app fetch data from Airtable which was pretty straightforward. I have a problem with Airtable connection.My data is 400+ records and i need to fetch all data for filtering and ranking. But Airtable will return a max of 100 records.

I have read this topice: Airtable + pagination. But i don’t know how to do it. Would you care to elaborate?

Any help appreciated.

The response from Airtable API includes an offset key, such as recIuG3TsQy34xLbu. To fetch the next 100 records, you’d define an offset optional non-static query parameter for your Get collection route. Then, when using your data variable, you can pass the offset value from your first response to get a next set of data.

Where should we be putting this to get the ranked number? I’ve tried it under a paragraph components content section using a formula and the result is a list of items that have “OBJECT, OBJECT,…” over and over again displayed in that paragraph component.

Or if put the formula under the list component’s “repeat with” section, the result is a repeated list with just 1, 2, 3, 4, 5, etc. with no other information from the list displaying.

Can you help me sort where I am going wrong?

I tested this and it worked well for me. The Formula should added to the Repeat with property. Or you can use it when you set your Data/Page/App variable or whatever you use to store your data.

If you see only the numeric_index make sure that you have your List (here items) has the data for real. You can try that by just repeating the List first without this Formula.

1 Like

I was changing the first “item” in the MAP function was my issue. I also added a Sort By around the “items” list in order to sort before ranking for a leaderboard.

All sorted now! Thank ya

1 Like