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: [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!