Chris:
no, he's passing the arguments properly using the argumentCollection.
it's a "special" kind of argument (there's probably a better way to
phrase it...) that, when passed in as a struct, is deconstructed into
individual argument variables inside the method.
On 1/4/07, Christopher Jordan <[EMAIL PROTECTED]> wrote:
> Dude, you're passing in a structure, but you're init is expecting two
> separate variables one of which is numeric.
>
> When you call a CFC, the Arguments scope (read: structure) already
> contains everything you sent. If you want to pass in a structure
> yourself, then change your init to read:
>
> <CFArgument Name="MyStruct" Type="struct" required="true">
>
> Then you'd access your structure like, MyStruct.rs.Firstname or
> MyStruct.rs.ID.
>
> You could also skip the CFArgument tag altogether and just access them
> like this:
>
> Arguments.MyStruct.rs.FirstName, and Arguments.MyStruct.rs.ID
>
> Hope that helps.
>
> Cheers,
> Chris
>
> Daniel Short wrote:
> > Well Josh, it's time to get your space helmet, because indeed there is a
> > gaping hole (as best I can tell anyway) :). My sample code defines a
> > recordset with just a single row, with a type of numeric, and a valid value.
> >
> > After all, here's my test code:
> >
> >
> > <!--- Get a query --->
> > <cfset rs = QueryNew("ID,FirstName", "integer,varchar") />
> > <cfset QueryAddRow(rs) />
> > <cfset QuerySetCell(rs, "ID", 3) />
> > <cfset QuerySetCell(rs, "FirstName", "Daniel") />
> >
> > <cfset TestStruct = StructNew() />
> > <cfloop list="#rs.ColumnList#" index="col">
> > <cfset TestStruct[col] = rs[col] />
> > </cfloop>
> >
> > <cfdump var="#TestStruct#" />
> >
> > <!--- Pass the newly created struct into the object to run each setter --->
> > <cfset MyObject = CreateObject("component",
> > "cfcs.test").init(ArgumentCollection = TestStruct) />
> >
> > <cfdump var="#MyObject.getSnapShot()#" />
> >
> > As you can see, I'm generating a super simply query, and then passing it
> > into the object, and somewhere along the line CF is getting completely
> > confused about the type...
> >
> > Dan
> >
> >
> > On 1/4/07 4:39 PM, "Josh Nathanson" <[EMAIL PROTECTED]> wrote:
> >
> >
> >> I've only gotten this error when I've accidentally passed a null value (for
> >> example the query returned empty) and it's expecting a numeric.
> >>
> >> Make sure that when you're initially building the structure from the query,
> >> that you're indeed passing in all the values you expect, by dumping the
> >> query before you convert it into a struct. Then, after conversion into the
> >> struct, dump the struct as well to make sure it's still the right value.
> >>
> >> I'd be surprised if it was actually failing on a numeric value. This would
> >> open a hole in the time-space continuum.
> >>
> >> -- Josh
> >>
> >> ----- Original Message -----
> >> From: "Daniel Short" <[EMAIL PROTECTED]>
> >> To: "CF-Talk" <[email protected]>
> >> Sent: Thursday, January 04, 2007 2:23 PM
> >> Subject: Issue with "not of type numeric" when sending value to CFC
> >>
> >>
> >>
> >>> Hi,
> >>>
> >>> I have a blog post which details my problem here:
> >>>
> >>> http://www.dansshorts.com/?day=1/4/2007#blog360
> >>>
> >>> What's happening is that if I take a recordset row, and build a structure
> >>> based on it's columns, and then pass that structure as an
> >>> ArgumentCollection
> >>> to a CFC, the method tosses a "not of type numeric" on a value that is
> >>> indeed numeric.
> >>>
> >>> Has anyone else seen a problem like this? The only way around it has been
> >>> to
> >>> set the type to "any" and then just accept any old crap that someone wants
> >>> to pass in.
> >>>
> >>> Thanks,
> >>>
> >>> --
> >>> Daniel Short
> >>> Web Application Architect
> >>> lynda.com, Inc.
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265720
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4