Simple sort of table - Missing somethng

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

Welcome to the community, @Bob_Boursaw! :smiley: 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:

1 Like

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

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.