is productid a character type on the database? if so you may want to wrap a
trim() around it somewhere in the sql or maybe an int() function (depending
on your dbms)
if it is numeric on the db then I have no idea :-)
On 8/16/06, Rey Bango <[EMAIL PROTECTED]> wrote:
>
> I'm a little stumped on this. I have a cfc which contains a method that
> checks inventory levels. Its defined as:
>
> <cffunction name="chkMDSInventory" access="remote" returntype="boolean">
> <cfargument name="productid" type="numeric" required="yes">
> <cfargument name="orderitemqty" type="numeric" required="yes">
> .......
> <cfreturn hasMDSInv>
> </cffunction>
>
> I've used this in my code before with no issues at all.
>
> So, I go to use it in another part of the site via the following snippet
> of code:
>
> <!--- Instantiate inventory checker - Inventory.cfc --->
> <cfset invOBj =
> createObject("component","com.inventory.inventory").init() />
>
> <cfquery name="getProductInfo" datasource="#request.ds#">
> Select ProductID
> from products
> where sku = <cfqueryparam value="#trim( evaluate( variables.sku ) )#"
> cfsqltype="CF_SQL_VARCHAR">
> </cfquery>
>
> <cfif NOT invObj.chkMDSInventory( getProductInfo.productid,
> variables.thisquantity )>
> <cfset groundShipOnly = true>
> </cfif>
>
> When I run this, I get an error back saying:
>
> "The argument PRODUCTID passed to function chkMDSInventory() is not of
> type numeric."
>
> Now, I've verified that both getProductInfo.productid &
> variables.thisquantity are numeric by using the isNumeric CF function
> and they are numeric values. But it still throws this error. The code
> above is almost exactly to code that I use in another part of the site
> which performs perfectly.
>
> Now here's the kicker. If I change the code to this:
>
> <cfset pid = Numberformat( getProductInfo.productid )>
> <cfset pQty = Numberformat( variables.thisquantity )>
>
> <cfif NOT invObj.chkMDSInventory( variables.pid, variables.pQty )>
> <cfset groundShipOnly = true>
> </cfif>
>
> it works just fine! I'm stumped. I have no idea why isNumeric() would
> report the values as numeric but the CFC's method won't especially when
> this same code works just fine in another part of the site.
>
> Any ideas?
>
> Rey...
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250041
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4