ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 21st, 2005, 11:27 AM
mparker1113 mparker1113 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 254 mparker1113 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 29 m 48 sec
Reputation Power: 5
placing query output into an array?

Hello,

I am doing a search for existing database records which might be a duplicate record (ie Sue Jones repeated as Susan Jones).

I am using a SQL Like statement to find similar records to my input form. I would like to store the potentially similar records in an array so that I can verify that I do not have duplicates of my potential duplicates.

How can I fill an array with values that I get from a query?
I have tried the following, but it doesn't work.

Thanks, you guys are great.!
Code:
      <cfquery name="checkForDupes" datasource="Rents">
         Select * from Rents where Lessor Like '%#LessorBroken#%' AND Address Like '%#AddressBroken#%'
      </cfquery>
     <cfoutput query="checkForDupes">
        similar_values[#valuIndex#] = #id# #Lessor# #Address#
        #valuIndex# = #valuIndex# + 1
         <!--- WE Matched #LessorBroken# / #AddressBroken# at: #id#, #Lessor# <br>  --->
     </cfoutput>

Reply With Quote
  #2  
Old June 21st, 2005, 01:40 PM
fortunato fortunato is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 33 fortunato User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 36 m 52 sec
Reputation Power: 4
Perhaps this will work? There are other ways, but this one aint too bad ...

Code:
<cfset similarValues = ArrayNew(1)>

<cfquery name="checkForDupes" datasource="Rents">
	Select * from Rents where Lessor Like '%#LessorBroken#%' AND Address Like '%#AddressBroken#%'
</cfquery>
<cfloop query="checkForDupes">
	<cfset ArrayAppend(similarValues,"#id# #Lessor# #Address#")>
</cfloop>






Quote:
Originally Posted by mparker1113
Hello,

I am doing a search for existing database records which might be a duplicate record (ie Sue Jones repeated as Susan Jones).

I am using a SQL Like statement to find similar records to my input form. I would like to store the potentially similar records in an array so that I can verify that I do not have duplicates of my potential duplicates.

How can I fill an array with values that I get from a query?
I have tried the following, but it doesn't work.

Thanks, you guys are great.!
Code:
      <cfquery name="checkForDupes" datasource="Rents">
         Select * from Rents where Lessor Like '%#LessorBroken#%' AND Address Like '%#AddressBroken#%'
      </cfquery>
     <cfoutput query="checkForDupes">
        similar_values[#valuIndex#] = #id# #Lessor# #Address#
        #valuIndex# = #valuIndex# + 1
         <!--- WE Matched #LessorBroken# / #AddressBroken# at: #id#, #Lessor# <br>  --->
     </cfoutput>

Reply With Quote
  #3  
Old June 21st, 2005, 04:28 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,655 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 13 h 29 m 20 sec
Reputation Power: 53
Why don't you just select distinct records with the query to begin with?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > placing query output into an array?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway