+1 vote

I'm trying to display a high score list that is stored in an Airtable. I can connect to the Airtable and display it (kinda) like this:

*service: highscore
	*path: /highscore
	*send: {"maxRecords" -> 10}
	*method: GET
		>> response = it["records"]
		An error occurred!

>> i = 0
*while: i < response.size
			<td> {response[i]["fields"]["Name"]} </td>
			<td> {response[i]["fields"]["Score"]} </td>
	>> i = i + 1

However, I'd like to sort the collection to get the top 10 scorers, but can't figure out the right way to sort both score and name simultaneously.

I'd also like to know how to display this content in a name table with Name and Score headers, but can't quite figure out the right way.

by (130 points)

1 Answer

+1 vote

Hi there,

To answer your questions:
Sort the collection: you might want to sort at the time you are pulling the data from Airtable, could be something like:

path: /table1?sort%5B0%5D%5Bfield%5D=Score&sort%5B0%5D%5Bdirection%5D=desc

About table header: you might want to use <th></th> outside of your while loop.
Hint: put the html table into variable before showing it

Check this out, I built a sample that might help you; https://www.guidedtrack.com/programs/25353


by (160 points)
Welcome to Guidedtrack Q&A, where you can ask questions and receive answers from other members of the community.
134 questions
144 answers
40 users