Copy link to clipboard
Copied
The argument TEAM passed to function SearchRes() is not of type numeric. | |
If the component name is specified as a type of this argument, the reason for this error might be that a definition file for such component cannot be found or is not accessible. | |
The error occurred in C:\Inetpub\wwwroot\search.cfc: line 4 | |
2 : 3 : <cffunction name="SearchRes" access="public" returntype="query"> 4 : <cfargument name="DSN" type="string" required="yes"> 5 : <cfargument name="Role" type="string" required="no"> 6 : <cfargument name="Team" type="numeric" required="no"> |
Please look at the above error...any help app...
code ------------------------->
<cfcomponent hint="This cfc does search...">
<cffunction name="SearchRes" access="public" returntype="query">
<cfargument name="DSN" type="string" required="yes">
<cfargument name="Role" type="string" required="no">
<cfargument name="Team" type="numeric" required="no">
<cfargument name="Level" type="numeric" required="no">
<cfargument name="zone" type="numeric" required="no">
<cfargument name="Dept" type="numeric" required="no">
<cfargument name="location" type="numeric" required="no">
<cfargument name="csgid" type="string" required="no">
<cfargument name="status" type="string" required="no">
<cfargument name="filter" type="string" required="no">
<cfargument name="bosseid" type="string" required="no">
<cfdump var="#arguments#">
<cfquery datasource="#arguments.DSN#" name="SearchRes">
Select
r.First_name,
r.Last_name,
r.EID,
r.tech_id,
r.title,
r.hire_date,
r.rehire_date,
l.location,
d.department
from
OPS$RMS.REF_resource r,
OPS$RMS.Ref_department d,
OPS$RMS.REF_Location l
where
r.location_code = l.location_code
And r.department_code = d.department_code
<cfif arguments.role neq "">
And r.role_code = '#arguments.role#'
</cfif>
<cfif arguments.Team neq "">
And r.team_code = #arguments.team#
</cfif>
<cfif arguments.level neq "">
And r.level_code = #arguments.level#
</cfif>
<cfif arguments.zone neq "">
--And r.zone_code = #arguments.zone#
</cfif>
<cfif arguments.dept neq "">
And r.department_code = #arguments.dept#
</cfif>
<cfif arguments.location neq "">
And r.location_code = #arguments.location#
</cfif>
<cfif arguments.csgid neq "">
And r.csg_operator_id like '#arguments.csgid#%'
</cfif>
<cfif arguments.status neq "">
And r.status = '#arguments.status#'
</cfif>
<cfif arguments.filter neq "">
And
(
r.EID = '#arguments.filter#%'
OR r.First_name like '#arguments.filter#%'
OR r.last_name like '#arguments.filter#%'
OR r.tech_id like '#arguments.filter#%'
)
</cfif>
<cfif arguments.bosseid neq "">
And r.boss_id = '#arguments.bosseid#%'
</cfif>
</cfquery>
<cfreturn SearchRes>
</cffunction>
</cfcomponent>
Copy link to clipboard
Copied
emmim44 wrote:
The argument TEAM passed to function SearchRes() is not of type numeric.
The error message seems quite clear. The value you are passing in for TEAM argument is not numeric.
Copy link to clipboard
Copied
I checked it is... these fields are coming from a search page... all of them can be null....or any of them
Copy link to clipboard
Copied
Can you show the code where you call the function? Are you passing the arguments in as an argument collection or individually?
Might not be an issue but, while your Team variable can be null, the cfargument tag types the variable as a numeric value (as opposed to any or whatever). Depending on what you're supplying this could be a source of the error.
Copy link to clipboard
Copied
you would have to do some validation [and/or typing] on the variable before you pass it to the function. basically, make sure it is a number before you pass it on.
Copy link to clipboard
Copied
craigkaminsky wrote:
Might not be an issue but, while your Team variable can be null, the cfargument tag types the variable as a numeric value (as opposed to any or whatever). Depending on what you're supplying this could be a source of the error.
As mentioned we would have to see the code. But that could well be the problem. There is really no concept of a "null" form field. If you are passing in the values of text fields, empy fields will be treated as an empty string "". Since an empty string is not numeric, it would cause exactly the error you are describing.
<!--- simulate an empty form field ---->
<cfset form.someField = "" />
<cfoutput>#test(form.someField)#</cfoutput>
<cffunction name="test" returntype="string">
<cfargument name="someValue" type="numeric" />
<cfreturn "okay"/>
</cffunction>