Solved

CFINDEX / CFCOLECTION / CFSEARCH

Posted on 2002-07-25
9
275 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 17

Author Comment

by:anandkp
Comment Utility
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
Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

 
LVL 5

Expert Comment

by:CFXPERT
Comment Utility
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
Comment Utility
Thanx CFXpert ...

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

Thanx once again ... :)

K'Rgds,
Anand
0
 
LVL 17

Author Comment

by:anandkp
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now