Alphabetical order and the word "The"

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

By zip222 - April 29, 2010

Can anyone provide me some guidance on alphabetizing a list or organizations when some of them start with "The"? A manual sort is not really an option.

thanks.

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/