Pete,
Actually, you would just execute a CFQUERY that would return that one record,
and as long as your KEY is the same, issue your cfindex just like you would if
you were indexing a query with 1,000 records.
<cfquery name="getNewDataCardForIndexing">
select [your fields]
from [your table]
where [your criteria to return just the new record]
</cfquery>
<cfindex action="UPDATE" collection="coll_datacards" type="CUSTOM"
key="id" title="name" query="getNewDataCardForIndexing" body="name,
cardcontent, metadata">
That's all you need to do. Now, you could also build the query dynamically if
you don't want to re-query your databse, using the query functions.
HTH,
Dave
-----Original Message-----
From: Pete Ruckelshaus [mailto:[EMAIL PROTECTED]
Sent: Friday, August 19, 2005 2:31 PM
To: CF-Talk
Subject: CFINDEX - how to add/update a single record in an existing
collection?
Sometimes, no, make that usually, Macromedia's documentation for CF
just barely scratches the surface.
I have an existing collection that is populated from a query. The
data returned from this query gets updated quite often. In order to
allow accurate searches, I would like to add (for new records) or
update a record in a collection from query data...actually, I'll be
passing the data in via a CFC...
Is there a way to do this? Here is the original tag call to populate
the collection:
<cfindex action="UPDATE" collection="coll_datacards" type="CUSTOM"
key="id" title="name" query="getDatacardsForIndexing" body="name,
cardcontent, metadata">
So, in order to do this, would I do something like:
<cfindex action="UPDATE" collection="coll_datacards" type="CUSTOM"
key="#arguments.id#" title="#arguments.name#" body="#arguments.name#,
#arguments.cardcontent#, #arguments.metadata#">
(note that I omitted the query attribute). Would this update just a
single record in the coll_datacards collection?
Thanks,
Pete
PS Is it time to create an "Undocumented CF" web site? If there's
enough interest and enough content, I'm willing to start this as a
project...I just know that between things like cfcollection (and
related tags), cfdocument, cfchart, and more that there's a lot of
stuff that Macromedia doesn't cover in their docs.
******************************************************************************************
The information contained in this message, including attachments, may contain
privileged or confidential information that is intended to be delivered only to
the
person identified above. If you are not the intended recipient, or the person
responsible for delivering this message to the intended recipient, ALLTEL
requests
that you immediately notify the sender and asks that you do not read the
message or its
attachments, and that you delete them without copying or sending them to anyone
else.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:215822
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54