Question
The Argument passed to a function is not of type numeric
Hi,
Can someone please tell me what's wrong with this code and it's giving me an error "The argument INTPREVAGREEMENTID passed to function getPreviousAgreementID() is not of type numeric.?
Here's the Cffunction:
<cffunction name="getPreviousAgreementID" access="public" returntype="numeric" output="false">
<cfargument name="intPrevAgreementID" type="numeric" required="yes">
<cfquery name="getPrev" datasource="#application.DSN#">
SELECT TOP 1 Agreement_ID
FROM Agreements
WHERE Agreement_ID < <cfqueryparam value="#arguments.intPrevAgreementID#" cfsqltype="cf_sql_numeric">
ORDER BY Agreement_ID DESC
</cfquery>
<cfif getPrev.recordcount EQ 0>
<cfset prevAgreement= -1>
<cfelse>
<cfset prevAgreement = getPrev.Agreement_ID>
</cfif>
<cfreturn prevAgreement>
</cffunction>
----
The code calling this cffunction,
<cfset previousAgreement = oAgreement.getPreviousAgreementID(tempAgreementId)>
<cfif len(trim(previousAgreement)) NEQ 0>
<img src="images/iconprevious.gif" width="22" height="16" alt="Previous Agreement" onClick="btnSubmit('salesrep_Agreement.cfm?record=#previousAgreement#')" class="mouse">
</cfif>
-----tempAgreementId -----
<cfif url.record NEQ -1>
<cfset tempAgreementId = url.record>
</cfif>
url.record is set initially to -1. I Also tried using 0 just for testing purposes and still gave the same error.
Please help!
Thanks.
Can someone please tell me what's wrong with this code and it's giving me an error "The argument INTPREVAGREEMENTID passed to function getPreviousAgreementID() is not of type numeric.?
Here's the Cffunction:
<cffunction name="getPreviousAgreementID" access="public" returntype="numeric" output="false">
<cfargument name="intPrevAgreementID" type="numeric" required="yes">
<cfquery name="getPrev" datasource="#application.DSN#">
SELECT TOP 1 Agreement_ID
FROM Agreements
WHERE Agreement_ID < <cfqueryparam value="#arguments.intPrevAgreementID#" cfsqltype="cf_sql_numeric">
ORDER BY Agreement_ID DESC
</cfquery>
<cfif getPrev.recordcount EQ 0>
<cfset prevAgreement= -1>
<cfelse>
<cfset prevAgreement = getPrev.Agreement_ID>
</cfif>
<cfreturn prevAgreement>
</cffunction>
----
The code calling this cffunction,
<cfset previousAgreement = oAgreement.getPreviousAgreementID(tempAgreementId)>
<cfif len(trim(previousAgreement)) NEQ 0>
<img src="images/iconprevious.gif" width="22" height="16" alt="Previous Agreement" onClick="btnSubmit('salesrep_Agreement.cfm?record=#previousAgreement#')" class="mouse">
</cfif>
-----tempAgreementId -----
<cfif url.record NEQ -1>
<cfset tempAgreementId = url.record>
</cfif>
url.record is set initially to -1. I Also tried using 0 just for testing purposes and still gave the same error.
Please help!
Thanks.