Sort a list in Bases disregarding the article

What I’m trying to do

When sorting a View in Bases for film / book titles I want to disregard the article. So for example “La Strada” sorts as “strada” or “The Great Gatsby” sorts on “great gatsby”. My films and books contain titles in more than five languages so there are quite some articles I want to drop.

Things I have tried

I could find no examples in the bases documentation or on this forum with the use of standard functions in bases. So it seems I have to write something specific for this purpose.

I wrote a simple function in Javascript that does what I want to do however I can find no way to call it in Bases. For example after I put my function in customJS, I tried:

formulas:
  key: customJS.SortHelper.sortKey(file.name)

This does not work.

I also tried put the code in an anonymous function:

formulas:
  key: ( () => {    // Function Body...} )();

This does not work.

Is there any way to achieve what I want

or more in general, call a custom javascript function in a Bases formula ?

Bases cannot call Javascript, nor is it Javascript, it’s a domain specific language to Bases.

I have a formula that I sort by that replaces the leading “the” (if it exists) and sort by that, you can adjust this to handle other articles.

file.name.replace(/^the /i, '')

I highly recommend reviewing the Bases syntax to better understand the syntax of Bases and the functions available to you.

OK, Thanks, clear

As a non-programmatic solution, you might want to list the titles as Strada (La) and Great Gatsby (The)