Help

Simple sort of table - Missing somethng

Topic Labels: Extensions
Solved
Jump to Solution
1032 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Bob_Boursaw
4 - Data Explorer
4 - Data Explorer

I am new to Airtable and am sure I am missing something very basic here. I have a base with a table of clients. I am trying to work with and better understand how to sort my table, but am clearly missing something. I have reviewed the posts I’ve found related to this topic and have not yet resolved my issue.
Following the API docs, I have modified my codes as follows.

let table = base.getTable(‘Client Appointments’);
let result = await table.selectRecordsAsync({
sorts: [
{field: “Client Name”, direction: “desc”},
]
})

All I am trying to do is simply sort my client table by the name column in des order, but the table never changes.

If I update my code to include output.table(result.records), then the output displayed following script execution in shows the outputted table with the sort order as defined in my code. However, the actual table remains unchanged.

What am I missing that is resulting in the table not sorting as expected?

Any help would be greatly appreciated.

Thank you!
Bob

1 Solution

Accepted Solutions
Justin_Barrett
18 - Pluto
18 - Pluto

Welcome to the community, @Bob_Boursaw! :grinning_face_with_big_eyes: It looks like you might be misunderstanding what the Scripting block is designed to do. Long story short, you cannot change record order using the Scripting block. The data sort you’re doing is within the script alone and, as you’ve seen, has no bearing on the data in the table. To sort the table, you use the Sort item on the view toolbar at the top of the table. Here’s an overview of record sorting:

See Solution in Thread

2 Replies 2
Justin_Barrett
18 - Pluto
18 - Pluto

Welcome to the community, @Bob_Boursaw! :grinning_face_with_big_eyes: It looks like you might be misunderstanding what the Scripting block is designed to do. Long story short, you cannot change record order using the Scripting block. The data sort you’re doing is within the script alone and, as you’ve seen, has no bearing on the data in the table. To sort the table, you use the Sort item on the view toolbar at the top of the table. Here’s an overview of record sorting:

Thank you for the education and quick response. Very much appreciated.