If you download the CF Cookbook (check my blog from last week) you
will see how I update a collection from the CFC. That doesn't show the
_initial_ creation though. Here is the temp script I used for that:
<cfcollection action="list" name="collections">
<cfset names = valueList(collections.name)>
<cfif not listFindNoCase(names, "cfcookbook")>
<cfset cDir = server.coldfusion.rootDir & "/verity/collections">
<cfcollection action="create" collection="cfcookbook" path="#cDir#"
categories=true language="EnglishX">
<cfoutput>Created the cfcookbook collection<p></cfoutput>
</cfif>
<!--- begin by clearing out existing collection --->
<cfindex collection="cfcookbook" action="purge">
<!--- get all data --->
<cfquery name="getData" datasource="cfcookbook">
select entries.question, entries.answer, entries.id
from entries
</cfquery>
<cfset queryAddColumn(getData,"categoryidfk","Integer",arrayNew(1))>
<cfloop query="getData">
<!--- get one category --->
<cfquery name="getCat" datasource="cfcookbook">
select categoryidfk
from entries_categories
where entryidfk = #id#
</cfquery>
<cfset cid = getCat.categoryidfk[1]>
<cfset querySetCell(getData,"categoryidfk",cid,currentRow)>
</cfloop>
<cfindex collection="cfcookbook" type="custom" action="update"
query="getData"
key="id"
title="question"
body="question,answer"
custom1="categoryidfk"
>
<cfoutput>Indexed #getData.recordCount# entries.<p></cfoutput>
On 1/24/06, Rey Bango <[EMAIL PROTECTED]> wrote:
> Thanks Ray,
>
> You wouldn't happen to have a snippet of code that I can look at and
> use? If you do, please be sure to attach a license agreement lest
> someone takes it for their own and markets it. ;o)
>
> Rey...
>
--
=======================================================================
Raymond Camden, Director of Development for Mindseye, Inc (www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)
Email : [EMAIL PROTECTED]
Blog : ray.camdenfamily.com
Yahoo IM : cfjedimaster
"My ally is the Force, and a powerful ally it is." - Yoda
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230300
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