Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Cffunction error

Participant ,
Jul 20, 2009 Jul 20, 2009

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>

TOPICS
Advanced techniques
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jul 20, 2009 Jul 20, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 20, 2009 Jul 20, 2009

I checked it is... these fields are coming from a search page... all of them can be null....or any of them

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 20, 2009 Jul 20, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 20, 2009 Jul 20, 2009

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jul 20, 2009 Jul 20, 2009
LATEST

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources