Solved

CFINDEX / CFCOLECTION / CFSEARCH

Posted on 2002-07-25
9
283 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
 
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
Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Time Sheet Help 6 45
Asp.net Hosting Plan security, reliable, stable 1 72
Domino Website - Redirection 12 53
http to https 3 43
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

14 Experts available now in Live!

Get 1:1 Help Now