rmstokes Posted January 16, 2008 Share Posted January 16, 2008 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 More sharing options...
doughemi Posted January 16, 2008 Share Posted January 16, 2008 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 More sharing options...
rmstokes Posted January 16, 2008 Author Share Posted January 16, 2008 Create a calculation sortfield with the calculationcase( 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 More sharing options...
rmstokes Posted January 16, 2008 Author Share Posted January 16, 2008 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 More sharing options...
rmstokes Posted January 16, 2008 Author Share Posted January 16, 2008 oops, spoke too soon! sortfield doesn't seem to be sorting alphabetically now ... any ideas are immensely appreciated! Link to comment Share on other sites More sharing options...
rmstokes Posted January 16, 2008 Author Share Posted January 16, 2008 ok the calculation result was set at "number" I changed it to "text" and it seems to be working now. Link to comment Share on other sites More sharing options...
AHunter3 Posted January 16, 2008 Share Posted January 16, 2008 Is sortfield a calc field of result type "text"? It needs to be. EDIT: nevermind, you already caught that Link to comment Share on other sites More sharing options...
David Head Posted January 17, 2008 Share Posted January 17, 2008 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 More sharing options...
rmstokes Posted January 17, 2008 Author Share Posted January 17, 2008 So Cool! you people are incredible ... thank you. Link to comment Share on other sites More sharing options...
Recommended Posts