Solved

CFINDEX / CFCOLECTION / CFSEARCH

Posted on 2002-07-25
9
303 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 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