Jump to content
Salesforce and other SMB Solutions are coming soon. ×

sorting movie titles omitting "The" and "A"


rmstokes

Recommended Posts

Hi All,

 

I'm a complete newbie so I'm sorry if this seems simple or it has been discussed before.

 

I want to sort movie titles by omitting "The" and "A" from the beginning of the titles and I don't have a clue. I'm assuming, of course, that I would need to create a script for this.

 

Any insight would be appreciated.

 

Thanks!

Link to comment
Share on other sites

Create a calculation sortfield with the calculation

case(
LeftWords(titlefield;1) = "The" ; RightWords(titlefield; WordCount(titlefield))-1;
LeftWords(titlefield;1) = "A" ; RightWords(titlefield; WordCount(titlefield))-1;
titlefield
)

Make sure the calculation is unstored.

 

Now you can sort on sortfield either manually or by script.

 

--Doug

Link to comment
Share on other sites

Create a calculation sortfield with the calculation
case(
LeftWords(titlefield;1) = "The" ; RightWords(titlefield; WordCount(titlefield))-1;
LeftWords(titlefield;1) = "A" ; RightWords(titlefield; WordCount(titlefield))-1;
titlefield
)

Make sure the calculation is unstored.

 

Now you can sort on sortfield either manually or by script.

 

--Doug

 

Thanks Doug,

 

I appreciate the quick response!

 

But it doesn't seem to be doing what I want yet.

 

For the title, "THE MATRIX," I was hoping for a result of, simply "MATRIX" to sort with, instead I get a result of "-1" in the sortfield.

 

and concurrently for, "A BEAUTIFUL MIND," I also get a result of "-1" in the sortfield.

 

Thanks so much for your help!

Link to comment
Share on other sites

Ok I made an adjustment and it works now putting the -1 inside the parentheses;

 

case(

LeftWords(titlefield;1) = "The" ; RightWords(titlefield; WordCount(titlefield)-1);

LeftWords(titlefield;1) = "A" ; RightWords(titlefield; WordCount(titlefield)-1);

titlefield

)

 

Love this site and your guidance! Thanks!

Link to comment
Share on other sites

Try this calculation:

 

Let ([
source = titlefield;
wordlist = "¶The¶A¶An";
firstword = LeftWords ( source ; 1 );
source_mod = RightWords ( source ; WordCount ( source ) - 1 ) & ", " & firstword
];
If ( PatternCount ( wordlist ; ¶ & firstword ); source_mod; source )
)

 

It is more flexible allowing you to easily expand the wordlist as required.

It also returns the title as you might expect - The Matrix becomes Matrix, The.

Link to comment
Share on other sites



×
×
  • Create New...

Important Information

Terms of Use