<cfset pcodetable = left(session.postcode, 1)>
<cfset pcodeL = listfirst(session.postcode, " ")>
<cfset pcodeR = listlast(session.postcode, " ")>
<cfquery name="caller.pcode" datasource="capscan">
SELECT top 1000 *
FROM postcode_#pcodetable#
where postcode_#pcodetable#.col001 = '#pcodeL##pcodeR#' or 
postcode_#pcodetable#.col001 = '#pcodeL# #pcodeR#' or 
postcode_#pcodetable#.col001 = '#pcodeL#  #pcodeR#' or 
postcode_#pcodetable#.col001 = '#pcodeL#   #pcodeR#'
</cfquery>

I'm feeling pleased with myself, doesn't happen all that often with coding, lol

My aim was to make the postcode database I have on line available to other 
applications by using a CF tag.

I've shorted the original code by some 230 lines to produce this tag which 
gives instant address look up on 27 million postcodes.  (The length of the 
'where' line is because of the variation format of postcode field as supplied 
by Capscan.)

The data is split over 26 tables (alphbetically) to speed up the searches.

Doubtless this code needs more doing, but it's a start!

Jenny


-----Original Message-----
From: Jenny Gavin-Wear [mailto:[EMAIL PROTECTED]
Sent: 26 August 2006 00:47
To: CF-Talk
Subject: RE: Custom Tag


bingo, thanks Snake

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/427 - Release Date: 24/08/2006
 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:251097
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to