I've created the following code based on Tom and Matt's suggestion,
but all it does, according to a cfdump, is return the following. The
method should return two attributes (fldMass and fldName) and add them
to the structure.

Any ideas for a cfc newbie?

CFDUMP results
SELECTLIST      
function selectList
Arguments:
Name            Required        Type    Default
XFaction        Required        Any     1
XVType          Required        Any     1
XWeight         Required        Any     1
XEra              Required      Any     2
Return Type:  query
Roles:   
Access:         package
Output:          Yes


<cfscript>
        LightList = StructNew();
        LightList = createObject("component","unitlist");
        LightList.selectList(XFaction=1,XEra=2,XVType=1,XWeight=1);
        MedList = StructNew();
        MedList = createObject("component","unitlist");
        MedList.selectList(XFaction=1,XEra=2,XVType=1,XWeight=2);
        HvyList = StructNew();
        HvyList = createObject("component","unitlist");
        HvyList.selectList(XFaction=1,XEra=2,XVType=1,XWeight=3);
        AsltList = StructNew();
        AsltList = createObject("component","unitlist");
        AsltList.selectList(XFaction=1,XEra=2,XVType=1,XWeight=4);
</cfscript>

<cfcomponent>
        <cffunction name="selectList" access="package" returntype="query">
                <cfargument name="XFaction" required="true" default="1">
                <cfargument name="XVType" required="true" default="1">
                <cfargument name="XWeight" required="true" default="1">
                <cfargument name="XEra" required="true" default="2">
                <cfquery name="nameList" datasource="btech">
SELECT
  t.fldName,
  m.fldMass
FROM         tblTRO t, tblWeightClass w, tblVType v, tblMass m,
tblFaction f, tblEra e, tblClass c
WHERE      f.fldFactionID = t.fldFaction AND
                   w.fldWeightClassID = t.fldWeight AND
                   m.fldMassID = t.fldMass AND
                   c.fldClassID = t.fldClass AND
                   v.fldVTypeID = t.fldType AND
                   e.fldEraID = t.fldEra AND
                   (t.fldType = #arguments.XVType#) AND (t.fldFaction =
#arguments.XFaction#) and (t.fldEra = #arguments.XEra#) AND
(t.fldWeight = #arguments.XWeight#)
ORDER BY t.fldMass, t.fldName
                </cfquery>
                <cfreturn nameList>
        </cffunction>
</cfcomponent>

On Wed, 9 Feb 2005 08:46:30 -0600, Schreck, Tom <[EMAIL PROTECTED]> wrote:
> You can use the <cfinvoke> but the <cfinvoke> creates the CFC, calls a
> method, and then destroys the CFC.  So, if you need to call only a single
> method from a CFC, then it's ok to use <cfinvoke>.  If you need to call
> multiple methods from same cfc instance, then <cfinvoke> uses a lot of
> overhead.
> 
> Most of the time you will need to call multiple methods of an object.  So
> you can use createobject method within a <cfscript> block:
> 
> <cfscript>
>         oCFC = createObject("component","Package.Path.To.Where.CFC.Lives");
>         oCFC.method1(paramName=paramValue,paramName1=paramValue1,...);
>         oCFC.method2(paramName=paramValue,paramName1=paramValue1,...);
>         etc.
> </cfscript>
> 
> Another alternative to passing a list of name/value pairings is to create a
> structure containing data and use argumentcollection=structureName in place
> of all the name/value pairings.
> 
> Thanks
> 
> Tom Schreck
> 972-361-9943
> -----Original Message-----
> From: Chris Gomez [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 09, 2005 8:31 AM
> To: [email protected]
> Subject: CFC question
> 
> At last nights meeting, it was brought up that CFC's should not be
> called using the CFINVOKE command. If that's the case, then how would
> you call a CFC and, more importantly, how do you call a CFC that
> requires arguments be passed to it?
> 
> Thanks,
> 
> Chris
> ----------------------------------------------------------
> To post, send email to [email protected]
> To unsubscribe:
>    http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> To subscribe:
>    http://www.dfwcfug.org/form_MemberRegistration.cfm
> 
> ----------------------------------------------------------
> To post, send email to [email protected]
> To unsubscribe:
>    http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> To subscribe:
>    http://www.dfwcfug.org/form_MemberRegistration.cfm
> 
>
----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to