That should be "argumentCollection", not arguments

getParticipantGateway().getByFields(argumentCollection=fields);

Chris

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Byron Raines
> Sent: 26 September 2007 04:14
> To: [email protected]
> Subject: Re: [Reactor for CF] Passing parameters to getByFields
> 
> Thanks.  I'm not getting the error anymore.  But its now 
> returning all 
> records.  Not just the filtered.  A little more troubleshooting.
> 
> Byron
> 
> Qasim Rasheed wrote:
> > Just a little modification to Patrick's suggestion and I assume it 
> > will work
> >
> > fields = structNew();
> > fields['county'] = 2;
> > getParticipantGateway().getByFields( argumentsCollection=fields);
> >
> > Thanks
> >
> > Qasim
> >
> > On 9/25/07, *Porter, Benjamin L.* <[EMAIL PROTECTED] 
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> >     I believe it is expecting structure not a comma delimited list.
> >
> >     Change this
> >
> >     >>         <cfloop collection="#arguments#" item="key">
> >     >>             <cfif StructKeyExists(arguments,key)>
> >     >>                 <cfset
> >     >> fieldlist=ListAppend(fieldlist,"#key#=#arguments[key]#")>
> >     >>             </cfif>
> >     >>         </cfloop>
> >     <cfreturn getParticipantGateway().getByFields(#fieldlist#) />
> >
> >
> >     To
> >
> >
> >              <cfloop collection="#arguments#" item="key">
> >                  <cfif StructKeyExists(arguments,key)>
> >                             <cfset fieldList[key] = 
> arguments[key] />
> >                  </cfif>
> >              </cfloop>
> >
> >
> >     <cfreturn getParticipantGateway().getByFields(fieldlist) />
> >
> >     -----Original Message-----
> >     From: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >     [mailto:[EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>]
> >     On Behalf Of Byron Raines
> >     Sent: Tuesday, September 25, 2007 3:34 PM
> >     To: [email protected] 
> <mailto:[email protected]>
> >     Subject: Re: [Reactor for CF] Passing parameters to getByFields
> >
> >     Patrick,
> >
> >     Thanks.  Think it does the same thing.
> >
> >
> >           Oops!
> >
> >     *Message*       Invalid data {CountyID={2}} for CFSQLTYPE
> >     CF_SQL_CHAR.
> >     *Detail*
> >     *Extended Info*
> >     *Tag Context*  
> >     C:\ColdFusion8\wwwroot\Reactor\base\abstractGateway.cfc
> >     (92)
> >
> >
> >     byron
> >
> >     Patrick McElhaney wrote:
> >     > Try this:
> >     >
> >     > fields = structNew();
> >     > fields['county'] = 2;
> >     > getParticipantGateway().getByFields(fields);
> >     >
> >     > I think ColdFusion is taking getByFields(#fieldlist#) and
> >     reducing it
> >     > to  getByFields(fieldlist) which ends up as
> >     getByFields("County=2").
> >     >
> >     >
> >     > Patrick
> >     >
> >     >
> >     > On 9/25/07, Byron Raines <[EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>> wrote:
> >     >
> >     >> I have a weird problem.  I'm using the getByFields() 
> method on a
> >     gateway.
> >     >>
> >     >> getParticipantGateway().getByFields(County=2)
> >     >>
> >     >> I get back the expected results.  However, I am 
> constructing the
> >     >> parameter programatically, so I have:
> >     >>
> >     >> getParticipantGateway().getByFields(#fieldlist#)  where
> >     fieldlist  is
> >     >> "County=2".
> >     >>
> >     >> When I run it I get the following error:
> >     >>
> >     >>
> >     >>       Oops!
> >     >>
> >     >> *Message*       The cause of this output exception was that:
> >     >> 
> coldfusion.tagext.sql.QueryParamTag$InvalidDataException: Invalid
> >     data
> >     >> value CountyID=2 exceeds maxlength setting 5..
> >     >> *Detail*
> >     >> *Extended Info*
> >     >> *Tag Context*
> >     >>
> >     
> C:\ColdFusion8\wwwroot\Reactor\project\HopeWorks\Queries\mssql
> _4289702D0
> >     613A72FF692C035734D311D.cfm
> >     >> (1)
> >     >>
> >     >>
> >     >>
> >     >> Further inspection of the query file reveals the following:
> >     >>
> >     >> SELECT  [tblParticipant].[Pt_ID] AS [Pt_ID],
> >     [tblParticipant].[Phase]
> >     >> AS [Phase],  [tblParticipant].[CountyID] AS [CountyID],
> >     >> [tblParticipant].[Firstname] AS [Firstname],
> >     >> [tblParticipant].[Lastname] AS [Lastname],
> >     [tblParticipant].[Address]
> >     >> AS [Address],  [tblParticipant].[City] AS [City],
> >     >> [tblParticipant].[State] AS
> >     [State],  [tblParticipant].[ZipCode] AS
> >     >> [ZipCode],  [tblParticipant].[Phone] AS [Phone],
> >     >> [tblParticipant].[CircleLeaderID] AS [CircleLeaderID],
> >     >> [tblParticipant].[ConsentDate] AS [ConsentDate],
> >     >> [tblParticipant].[CircleLeader] AS [CircleLeader],
> >     >> [tblParticipant].[CC_ID] AS [CC_ID],  
> [tblParticipant].[GroupID] AS
> >     >> [GroupID],  [tblParticipant].[Status] AS [Status],
> >     >> [tblParticipant].[PARQ] AS
> >     [PARQ],  [tblParticipant].[MedicalForm] AS
> >     >> [MedicalForm],  [tblParticipant].[DateMedicalFormReturned] AS
> >     >> [DateMedicalFormReturned],  
> [tblParticipant].[FUSurveyDate] AS
> >     >> [FUSurveyDate],  [tblParticipant].[Cortisol] AS [Cortisol],
> >     >> [tblParticipant].[Notes] AS [Notes] FROM [tblParticipant] AS
> >     >> [tblParticipant] WHERE [tblParticipant].[Pt_ID] = 
> <cfqueryparam
> >     >> cfsqltype="cf_sql_char" maxlength="5"
> >     >> value="#arguments.Query.getValue(1)#" />
> >     >>
> >     >> Is there a way to dynamically construct the  
> parameter to go in the
> >     >> method.  For example:   I might dynamically create
> >     "County=2,Group=1".
> >     >> I'm trying to keep from having to have different 
> functions for each
> >     >> possible combination of filter variables.
> >     >>
> >     >> Here is the function I'm using:
> >     >>
> >     >>     <cffunction name="getParticipants" access="public"
> >     >> returntype="query" output="false">
> >     >>         <cfargument name="CountyID" type="numeric"
> >     required="false"
> >     />
> >     >>         <cfargument name="GroupID" type="numeric"
> >     required="false" />
> >     >>         <cfargument name="CircleLeaderID" type="string"
> >     required="false" />
> >     >>
> >     >>         <cfset fieldlist = "" />
> >     >>
> >     >>         <cfloop collection="#arguments#" item="key">
> >     >>             <cfif StructKeyExists(arguments,key)>
> >     >>                 <cfset
> >     >> fieldlist=ListAppend(fieldlist,"#key#=#arguments[key]#")>
> >     >>             </cfif>
> >     >>         </cfloop>
> >     >>
> >     >>         <cfreturn
> >     getParticipantGateway().getByFields(#fieldlist#) />
> >     >>
> >     >>     </cffunction>
> >     >>
> >     >> Any help would be appreciated.
> >     >>
> >     >> Byron
> >     >>
> >     >>
> >     >>
> >     >> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- --
> >     -- --
> >     -- -- -- --
> >     >> Reactor for ColdFusion Mailing List
> >     >> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> >     >> Archives at: 
> http://www.mail-archive.com/reactor%40doughughes.net/
> >     >> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- --
> >     -- --
> >     -- -- -- --
> >     >>
> >     >>
> >     >>
> >     >
> >     >
> >     >
> >
> >
> >     -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- --
> >     -- --
> >     -- -- --
> >     Reactor for ColdFusion Mailing List
> >     [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> >     Archives at: 
> http://www.mail-archive.com/reactor%40doughughes.net/
> >     -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- --
> >     -- --
> >     -- -- --
> >
> >     
> **************************************************************
> **************
> >
> >     This email may contain material confidential to
> >     Pearson.  If you were not an intended recipient,
> >     please notify the sender and delete all copies.
> >     We may monitor email to and from our network.
> >     
> **************************************************************
> **************
> >
> >
> >
> >     -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- --
> >     -- -- -- -- --
> >     Reactor for ColdFusion Mailing List
> >     [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> >     Archives at: 
> http://www.mail-archive.com/reactor%40doughughes.net/
> >     -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- --
> >     -- -- -- -- --
> >
> >
> >
> >
> > -- 
> > Qasim Rasheed
> > Certified Advance ColdFusion MX Developer
> > (IM qasimrasheed AT yahoo, msn or GTalk)
> > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- 
> > -- -- -- --
> > Reactor for ColdFusion Mailing List
> > [EMAIL PROTECTED]
> > Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
> > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- 
> > -- -- -- -- 
> 
> 
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- -- -- -- --
> Reactor for ColdFusion Mailing List
> [EMAIL PROTECTED]
> Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> -- -- -- -- -- -- --
> 
> 
> 
> 
> 



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to