Alphabetical order and the word "The"

5 posts by 3 authors in: Forums > CMS Builder
Last Post: April 29, 2010   (RSS)

Re: [zip222] Alphabetical order and the word "The"

By Dave - April 29, 2010

Hi Zip,

So you just want it sorted as if there was no "The " in the name? Is that correct? Any other special conditions? And can you give a short example of the sample sorting output you'd like to see?

Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Alphabetical order and the word "The"

By zip222 - April 29, 2010

There are no other special conditions. Here is the viewer code:

list($corporations_foundationsRecords, $corporations_foundationsMetaData) = getRecords(array(
'tableName' => 'corporations_foundations',
'allowSearch' => '0',
));


<?php foreach ($corporations_foundationsRecords as $record): ?>
<li><?php echo $record['organization_name'] ?>" /></li>
<?php endforeach ?>

Re: [zip222] Alphabetical order and the word "The"

By Jason - April 29, 2010

Hi,

Give this a try:

list($corporations_foundationsRecords, $corporations_foundationsMetaData) = getRecords(array(
'tableName' => 'corporations_foundations',
'allowSearch' => '0',
'orderBy' => "SUBSTRING_INDEX(organization_name,'The',-1)",
));


This will organize the names as if there the word "The" was not there.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Alphabetical order and the word "The"

By zip222 - April 29, 2010

That didn't quite work. it placed the records starting with "The" at the beginning of the list, even though they don't belong there.

But I figured out the problem. You also need to include the space after the "The", like this... 'The '

thanks!