Solved

CFINDEX / CFCOLECTION / CFSEARCH

Posted on 2002-07-25
9
289 Views
Last Modified: 2013-12-24
Hi there,

I wanted to use the CFSEARCH ... i have created a collection ... but I dont have a clear picture on how to go ahead ...

I have a member table - with lot of details abt the member ... say around 100 fields having diff sets of data abt the member.

so i create a collection first:
<CFCOLLECTION ACTION="create"
    COLLECTION="akp"
    PATH="C:\CFUSION\Verity\Collections\">

then a index:
<CFQUERY NAME="Member" DATASOURCE="#IWD_DSN#" DBTYPE="ODBC" username="#IWD_USERNAME#" PASSWORD="#IWD_PASSWORD#">    
     SELECT * FROM Tbl_member_m
</CFQUERY>
<CFINDEX action="Update"
     collection="akp"
     key="MemberID"
     title="akp_index"
     type="Custom"
     query="Member"
     body="Age,email,username">


& search:
<CFSEARCH NAME="get"
    COLLECTION="akp" CRITERIA="sh">    
<CFOUTPUT QUERY="get">
     #Key#, #Username#<BR>    
</CFOUTPUT>

======================================================

Now what i want to do here is

1. to be able to display all the data abt the user present in the collection [ie all 100 fields].

2. define criteria for searching thru the collection [like if i wanna search for all members above the age of 24 & who are all males - then how do i do this ]

if ne-of u can help me out on this - it would be really great !!!

thanx for putting in ur time & effort

K'Rgds
Anand
0
Comment
Question by:anandkp
  • 6
  • 3
9 Comments
 
LVL 5

Expert Comment

by:CFXPERT
ID: 7180539
Not quite sure exactly what you want to do.  If you have a table that has all the member information.  WHy do you want to use a collection.

Just query the memeber table with specific filters like.

<cfquery name="getMember" datasource="#IWD_DSN#" username="#IWD_USERNAME#" PASSWORD="#IWD_PASSWORD#">
select *
from Tbl_member_m
where age >= 24
and etc,etc,etc
</cfquery>

To improve the performance of the query just make you add indexes to the columns in your table that will be queried on the most.

0
 
LVL 17

Author Comment

by:anandkp
ID: 7182029
Hi there,

I just want to know - if this is what i want to do - by using a collection - how do go abt doing it ...

I got thru with creation of collection & index ... now in search i want to be able to access all the data of the member table - but currently using the syntax written above - i cannot.

If u could pls tell me where [if] ive gone wrong ... or what is the correct procedure for doing this ... so i can access everything in CFSEarch - as if i was accessing it thru table ...

i'll await ur reply on this ...
Much Appreciation for ur HELP !

K'Rgds
Anand
0
 
LVL 5

Accepted Solution

by:
CFXPERT earned 150 total points
ID: 7192374
To be honest with you.  The method in which you want to use is not practical.  It is much more efficient to access the table that holds the data you want access to directly.  Using a <cfquery>

Most any expert would most likely agree.  Since no other expert has posted to your question I think that verifies my answer to your question.

It's simpl, you're tyring to return rows from a table in a database given a set of criteria.

<cfquery name="getMember" datasource="#IWD_DSN#" username="#IWD_USERNAME#" PASSWORD="#IWD_PASSWORD#">
select *
from Tbl_member_m
where age >= 24
and etc,etc,etc
</cfquery>

This is the way that it should be handled.  First rule of programming,  don't ever make things more complex than they need to be.

If you need help in re-writing any of your code please feel free to email me at kerry@tefftnet.com

I will help you out with all the particulars and get you going in the right direction.

cheers

:)
KWK


0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 17

Author Comment

by:anandkp
ID: 7205060
Hi CFXpert,

Thanx for the comment ...

what i wanted to know was the way in which i could proceed - had i to use cfcollection for this problem.

i dont need to rewrite me code .. its already working & site is running fine on the net.

i agree that - "don't ever make things more complex than they need to be"

but i just wanted to know - how to go abt using cf collection ... if u have a example with u - or if u can write one for the problem posted above [thou its not required in this case - I know]

pls let me know - anand@direct2s.com

thanx once again for all ur help :)

K'Rgds
Anand
0
 
LVL 5

Expert Comment

by:CFXPERT
ID: 7206032
Not a problem at all.  In my spare time I'll write some examples up for you to try out.

:)

KWK
0
 
LVL 17

Author Comment

by:anandkp
ID: 7208235
Thanx CFXpert ...

I'll await ur mails in my inbox !!!

Thanx once again ... :)

K'Rgds,
Anand
0
 
LVL 17

Author Comment

by:anandkp
ID: 7258339
Hi CFXpert -

a reminder from me ... for my earlier comment ...

I am still awiting

thanx !!!

K'Rgds,
Anand
0
 
LVL 17

Author Comment

by:anandkp
ID: 7264198
Hi CFXpert -

a reminder from me ... for my earlier comment ...

I am still awiting

thanx !!!

K'Rgds,
Anand
0
 
LVL 17

Author Comment

by:anandkp
ID: 7283489
Hi CFXpert - U Wrote

"Not a problem at all.  In my spare time I'll write some examples up for you to try out.

:)

KWK"
==================================================
I am still awiting

Thanx !!!

K'Rgds,
Anand
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question