Cffunction error

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>

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>

Similar Messages

  • Need help... Context validation error for tag cfscript.

    Code:
        <cffunction name="computeHash" access="public" returntype="String">
          <cfargument name="password" type="string" />
          <cfargument name="salt" type="string" />
          <cfargument name="iterations" type="numeric" required="false" default="1024" />
          <cfargument name="algorithm" type="string" required="false" default="SHA512" />
          <cfscript>
            var hashed = '';
            var i = 1;
            hashed = hash( password & salt, arguments.algorithm, 'UTF-8' );
            for (i = 1; i <= iterations; i++) {
              hashed = hash( hashed & salt, arguments.algorithm, 'UTF-8' );
            return hashed;
          </cfscript>
        </cffunction>
    Error on web app:
    Context  validation error for tag cfscript.
    The start tag must have a matching  end tag. An explicit end tag can be provided by adding </cfscript>. If the  body of the tag is empty you can use the shortcut <cfscript .../>. The CFML compiler was processing:
    a cfscript tag beginning on line 11, column 12.
    a cfscript tag beginning on line 11, column 12.
    The  error occurred in xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\salty.cfc: line  11
    9 :        <cfargument name="iterations" type="numeric" required="false" default="1024" />
    10 :        <cfargument name="algorithm" type="string" required="false" default="SHA512" />
    11 :        <cfscript>
    12 :           var hashed = '';
    13 :           var i = 1;
    I am completely lost on why it's fumbling with why it says there's no closing tag.  Help!!!!
    Thanks

    What's on lines 1-7 of that file?
    That code compiles fine for me on CF8 & CF9, so that's not where the error is.
    You're not trying to compile it on any earlier version of CF than CF8 are you?  The < and ++ operators are not valid prior to CF8.  CFMX7 might see the < as a stray angle bracket, and get confused.  I don't have CFMX7 running here to test the exact error that would produce, sorry.
    Adam

  • CFFUNCTION not working

    I am using CF5.0, but <CFFUNCTION> tag seems not
    working.
    Below is my codes,
    - Codes -
    <cffunction name="funcWelcomeMsg" returntype="string">
    <cfparam name="strUsername" type="string">
    <cfreturn strUrername>
    </cffunction>
    - Error -
    ColdFusion cannot determine how to process the tag
    <CFFUNCTION>. The tag name may be misspelled.
    If you are using tags whose names begin with CF but are not
    ColdFusion tags you should contact Allaire Support.

    Hi,
    Try doing it using <cfscript>
    <cfscript>
    function myFunction() {
    </cfscript>
    I do not think you can do it that way in CF 5. Is it possible
    for you to upgrade to at least ColdFusion MX? If so then your code
    would work I presume.
    -Westside

  • Cffunction, onSessionEnd throwing an error, please help

    Hello;
    I am using an application.cfc file to run my web site. I
    added an argument for onmissingtemplate and when I did that, it
    made my onSessionEnd statement throw an error:
    this is my statement:
    <cffunction name="onSessionEnd" returnType="void">
    <cfargument name="theSession" type="struct"
    required="true">
    <cfset var duration =
    dateDiff("s",arguments.theSession.created,now())>
    <cflog file="#THIS.name#" text="Session lasted for
    #duration# seconds.">
    </cffunction>
    and this is the error:
    Invalid CFML construct found on line 85 at column 1.
    ColdFusion was looking at the following text:
    <
    The CFML compiler was processing:
    < marks the beginning of a ColdFusion tag.Did you mean LT
    or LTE?
    The error occurred in C:\Websites\4npp8b\Application.cfc:
    line 85
    83 : </cfcomponent>
    84 :
    85 : <cffunction name="onSessionEnd" returnType="void">
    86 : <cfargument name="theSession" type="struct"
    required="true">
    87 : <cfset var duration =
    dateDiff("s",arguments.theSession.created,now())>
    I don't know if this will make a difference, but here is my
    onsessionstart function:
    <cffunction name="onSessionStart" returntype="any"
    output="true">
    <cfset SESSION.created = now()>
    </cffunction>
    I can't figure out what I did wrong to make it throw that
    error. Any ideas?
    CFmonger

    never mind, I figured it out. sorry to bother.

  • Cffunction valitation error

    Hi,
    I have a form where I  fill a customer-no. into an input field and get the customer name using databinding.
    This works fine, but when I put non-numeric values into customer-no I get following error:
    Error invoking CFC customer.cfc : The CUST_ID argument passed to the getcustomer function is not of type numeric. [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]
    The message is correct, but how can I avoid to run the getcustomer function when the value is not numeric?
    Here is my code:
    The form:
    <cfinput type="text" name="customer_no" style="width:140;background-color:yellow" maxlength="10"  validate="integer" validateat="onblur"   message="Customer No. format is integer">
    <cfinput type="text" name="customer_name" style="width:170" maxlength="200" bind="cfc:customer.getcustomer({customer_no})" readonly="yes">
    customer.cfc:
    <cfcomponent >
    <cffunction name="getcustomer" access="remote" returntype="string" output="yes"  >
        <cfargument name="cust_id"   type="numeric"  required="true" >
                     <cfset  r_customer = "">
             <cfquery name = "select_customer" dataSource = "x">
            SELECT name
            FROM customer
            WHERE id =  <cfqueryparam   cfsqltype="cf_sql_numeric" value="#arguments.cust_id#" >
            </cfquery>
    <cfreturn r_customer>
    </cffunction>
    </cfcomponent>

    biene22 wrote:
    The message is correct, but how can I avoid to run the getcustomer function when the value is not numeric?
    That is a trick question! The attribute bind="cfc:customer.getcustomer({customer_no})" implies that the function will run automatically, whether or not customer_no is numeric.

  • CFFUNCTION returntype error

    "The value returned from the addRequirement function is not
    of type query" is what I get when I execute the below function.
    This works fine in 7, but in 8 I get that error. Any ideas?
    <CFFUNCTION NAME="addItem" output="false"
    returntype="query">
    <CFARGUMENT NAME="userid" TYPE="numeric"
    REQUIRED="true">
    <CFARGUMENT NAME="title" TYPE="string"
    REQUIRED="true">
    <cfset var addRequirement = "">
    <CFQUERY NAME="addItem" datasource="#variables.dsn#">
    INSERT INTO test(userID,title)
    VALUES (#ARGUMENTS.userID#,'#arguments.title#')
    </CFQUERY>
    <cfreturn addItem>
    </CFFUNCTION>

    In addition to the insert not returning a result set, you
    have your var declared as 'addRequirement'
    but your query name and return value are 'addItem'
    If it were me, I'd set the return type to boolean, then set a
    var result = 'FALSE'. Wrap the insert query in a CFTRY and if it's
    sucessful, set result = 'TRUE' and then return result

  • Why setting var in CFFUNCTION causes error

    As far as my knowledge goes, the BEST practise when setting
    local variable inside a CFFUNCTION is to use the word "var" in
    front of the variable name, for example: <CFSET var
    myVariable="whatever">
    I'm doing it now and all I get is an error message saying:
    Error invoking CFC name_of_cfc:local variable myVariable on
    line 60 must be grouped at the top of the function body!
    I'm using CF8 and I need to use cfswitch within the
    cffunction, so when I do <cfcase value="SomeValue"><cfset
    var myVariable="TheValue"></cfcase> etc I got that error.
    When I tested with just CFSET var MyVariable="TheVariable"
    with no cfswitch/cfcase I still get that error
    when I took out the word "var" from cfset, I have no error, I
    put these variables directly after my cfarguments. Does anyone know
    why this is happening to me?
    I thought if I don't use the "var" word for my variable set
    within cffunction there will be possibilities when later on setting
    up another variables outside this function and if the name happen
    to be the same, will override each other and causing disaster to my
    application.
    Please help!!

    mega_L wrote:
    > As far as my knowledge goes, the BEST practise when
    setting local variable
    > inside a CFFUNCTION is to use the word "var" in front of
    the variable name, for
    > example: <CFSET var myVariable="whatever">
    Yes, this is the best practice to make the variable local to
    the
    function. But you only need to use the var keyword once when
    you define
    the variable. And you must define the local variables with
    the var
    keyword at the very beginning of the function body. The only
    content
    allowed before this happens are the argument definitions,
    i.e. the
    <cfargument ...> tags.
    If you have a variable that you don't need to use, you just
    need to
    define it with a default and|or dummy value in the beginning
    of the
    function. Then you can set it's value appropriately later in
    the
    function when it is required. This is often done with query
    tag return
    variables.
    I.E.
    <cffunction name="myQryFunction"...>
    <cfargument name="someArgument"...>
    <cfset var localQry = "">
    <cfquery name="localQry"...>
    SQL
    </cfquery>
    <cfreturn localQery>
    </cffunction>
    Because of this necessity to define all local variables at
    the beginning
    of the function, a lot of developers use a standard where
    they define a
    local structure. They can then just append new keys and
    values to this
    local structure throughout the function. Personally I don't
    see much
    advantage to doing this, but to each his|her own.
    I.E.
    <cffunction name="myQryFunction"...>
    <cfargument name="someArgument"...>
    <cfset var local = structNew()>
    <cfset local.something = "FooBar">
    <cfreturn local.something>
    </cffunction>

  • The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or

    I have taken the cfdump for tmpqry and it shows all data for
    the range ( No error at this step ) . But when we exceute this
    dbquery we get below mentioned error .
    <cfquery name="qry" dbtype="query" >
    SELECT *
    FROM tmpqry
    ORDER BY #arguments.colSort# ASC
    </cfquery>
    senerio:
    I am using createobject to create a reference for component
    and call MDArraySort function in the cfc and getting this error .
    'The system has attempted to use an undefined value, which
    usually indicates a programming error, either in your code or some
    system code.
    Null pointer is undefined.... '
    i am using this code in a cfc file.
    <cffunction name="MDArraySort" Returntype="query"
    access="public" >
    <cfargument name="colArray" type="array"
    required="true">
    <cfargument name="colNames" type="string"
    required="true">
    <cfargument name="colSort" type="string"
    required="true">
    <cfargument name="sensorIDs" type="string"
    required="true">
    <cfscript>
    var tmpqry = Querynew(arguments.colNames);
    var qRow = QueryAddRow(tmpqry, Arraylen(arguments.colArray)
    </cfscript>
    <cfloop from="1" to="#Arraylen(arguments.colArray)#"
    index="qRowIndex">
    <cfscript>
    sIndexinSensorIDs = colArray[qRowIndex]["SENSOR"]&"##";
    Temp_readin_code =
    colArray[qRowIndex]["READING_CODE"]&"##";
    QuerySetCell(tmpqry, 'SENSOR', sIndexinSensorIDs,
    qRowIndex);
    QuerySetCell(tmpqry,
    'TYPE',javacast('String',colArray[qRowIndex]["TYPE"]), qRowIndex);
    QuerySetCell(tmpqry, 'TIMESTAMP2',
    LSParseDateTime(colArray[qRowIndex]["TIMESTAMP2"]), qRowIndex);
    QuerySetCell(tmpqry,
    'ORDER_BY_PARAM',javacast('String',colArray[qRowIndex]["ORDER_BY_PARAM"]),
    qRowIndex);
    QuerySetCell(tmpqry, 'READING_CODE',Temp_readin_code ,
    qRowIndex);
    QuerySetCell(tmpqry,
    'READING',javacast('String',colArray[qRowIndex]["READING"]),
    qRowIndex);
    QuerySetCell(tmpqry,
    'PK_READING',javacast('String',colArray[qRowIndex]["PK_READING"]),
    qRowIndex);
    QuerySetCell(tmpqry,
    'ALARM_STATUS',javacast('String',colArray[qRowIndex]["ALARM_STATUS"]),
    qRowIndex);
    QuerySetCell(tmpqry, 'DURATION',
    javacast('String',colArray[qRowIndex]["DURATION"]), qRowIndex);
    QuerySetCell(tmpqry,
    'DESCRIPTION',javacast('String',colArray[qRowIndex]["DESCRIPTION"]),
    qRowIndex);
    </cfscript>
    </cfloop>
    <cfquery name="qry" dbtype="query" >
    SELECT *
    FROM tmpqry
    ORDER BY #arguments.colSort# ASC
    </cfquery>
    <cfreturn qry >
    </cffunction>
    It is working fine for some date range and and getting above
    mentioned error in sone situation .

    Hi All ,
    Thank you for your support ,
    Finally i have fix the issue using some changes in my
    function in cfc .
    <cffunction name="MDArraySort" Returntype="query"
    access="public" >
    <cfargument name="colArray" type="array"
    required="true">
    <cfargument name="colNames" type="string"
    required="true">
    <cfargument name="colSort" type="string"
    required="true">
    <cfargument name="sensorIDs" type="string"
    required="true">
    <cfscript>
    //Declare variable collection used in function as local
    --->
    var tmpqry =
    Querynew(arguments.colNames,"CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_DATE,CF_SQL_VARCHAR,CF_ SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR");
    var qRow = QueryAddRow(tmpqry,
    Arraylen(arguments.colArray));
    </cfscript>
    <cfloop from="1" to="#Arraylen(arguments.colArray)#"
    index="qRowIndex">
    <cfscript>
    // Populate the query table
    QuerySetCell(tmpqry, 'SENSOR',
    colArray[qRowIndex]["SENSOR"], qRowIndex);
    QuerySetCell(tmpqry,
    'TYPE',arguments.colArray[qRowIndex]["TYPE"], qRowIndex);
    QuerySetCell(tmpqry, 'TIMESTAMP2',
    LSParseDateTime(arguments.colArray[qRowIndex]["TIMESTAMP2"]),
    qRowIndex);
    QuerySetCell(tmpqry,
    'ORDER_BY_PARAM',arguments.colArray[qRowIndex]["ORDER_BY_PARAM"],
    qRowIndex);
    QuerySetCell(tmpqry, 'READING_CODE',
    colArray[qRowIndex]["READING_CODE"] , qRowIndex);
    QuerySetCell(tmpqry,
    'READING',arguments.colArray[qRowIndex]["READING"], qRowIndex);
    QuerySetCell(tmpqry,
    'PK_READING',arguments.colArray[qRowIndex]["PK_READING"],
    qRowIndex);
    QuerySetCell(tmpqry,
    'ALARM_STATUS',arguments.colArray[qRowIndex]["ALARM_STATUS"],
    qRowIndex);
    QuerySetCell(tmpqry, 'DURATION',
    arguments.colArray[qRowIndex]["DURATION"], qRowIndex);
    QuerySetCell(tmpqry,
    'DESCRIPTION',arguments.colArray[qRowIndex]["DESCRIPTION"],
    qRowIndex);
    </cfscript>
    </cfloop>
    <cfquery name="qry" dbtype="query" >
    SELECT *
    FROM tmpqry
    ORDER BY #arguments.colSort# ASC
    </cfquery>
    <cfreturn qry >
    </cffunction>
    Rajesh
    SCMS
    India

  • How to handle Coldfusion SOAP Web Service Errors

    Hi,
    I have just created simple wsdl example:
    My Component:
    <cfcomponent displayname="mytest">
        <cffunction name="service_login_authentication" access="remote" output="true" returntype="any" hint="Returns login">
         <cfargument name="login" type="string" required="yes">
            <cfargument name="password" type="string" required="yes">
              <cfif #arguments.login# eq "abcdef" and #arguments.password# eq "123456">
                      <cfxml variable="soapRes">                
                            <kps_response>
                                <message>OK</message>
                                <token>354dfdffsdf</token>
                             </kps_response>
                        </cfxml>
                 <cfelse>
                         <cfthrow type="MyException" message="INVALID LOGIN" errorcode="1000" />
             </cfif>        
          <cfreturn soapRes >
        </cffunction>
    </cfcomponent>
    Its generating wsdl and no problem with response but when generating any error like username and password does not match then it's generating fault code like this:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
          <soapenv:Fault>
             <faultcode>soapenv:Server.userException</faultcode>
             <faultstring>coldfusion.xml.rpc.CFCInvocationException: [coldfusion.runtime.CustomException : INVALID LOGIN. ]</faultstring>
             <detail>
                <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">HOST_NAME</ns1:hostname>
             </detail>
          </soapenv:Fault>
       </soapenv:Body>
    </soapenv:Envelope>
    But I want customize Fault Code like this:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
          <soapenv:Fault>
             <faultcode>1000</faultcode>
             <faultstring>INVALID LOGIN</faultstring>
          </soapenv:Fault>
       </soapenv:Body>
    </soapenv:Envelope>
    Fault Code and Fault String should be customize and I don't want detail tag completely. In old ColdFusion version like ColdFusion 8 displaying detail tag with <ns1:stackTrace xmlns:ns1="http://xml.apache.org/axis/"> coldfusion.xml.rpc.CFCInvocationException: and so on.
    Any suggestions on how to create customize faultcode and faultstring is very helpful.
    Thanks!!

    But my component is not produces this fault code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">                   
                                <soapenv:Body>                   
                                      <soapenv:Fault>                   
                                         <<faultcode>1000</faultcode>                   
                                                   <faultstring>INVALID LOGIN</faultstring>                   
                                      </soapenv:Fault>                   
                                   </soapenv:Body>                   
    </soapenv:Envelope>
    What is your ColdFusion Version as i have checked in ColdFusion 11 developer edition and ColdFusion 8 enterprise which is on window 2003 server.
    Could you please check my below component, did i am doing something wrong.
    <cfcomponent output="false">
        <cffunction name="service_login_authentication" access="remote" output="true" returntype="any" hint="Returns login">
         <cfargument name="login" type="string" required="yes">
            <cfargument name="password" type="string" required="yes">
      <cfset var isLoginValid = False>
            <cftry>
              <cfif #arguments.login# eq "1111" and #arguments.password# eq "1111">
                  <cfset isLoginValid = True>
                </cfif>
                 <cfif isLoginValid>
                        <cfsavecontent variable="soapRes"><?xml version="1.0" encoding="UTF-8"?>           
                           <kps_response>           
                               <message>OK</message>           
                               <token>354dfdffsdf</token>           
                            </kps_response>           
                         </cfsavecontent>           
                    <cfelse>           
                        <cfthrow type="MyException" message="INVALID LOGIN" errorcode="1000" />           
                    </cfif>
                      <cfcatch type="MyException">           
                         <cfsavecontent variable="soapRes">               
                                <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">                   
                                <soapenv:Body>                   
                                      <soapenv:Fault>                   
                                         <<cfoutput><faultcode>#cfcatch.errorCode#</faultcode>                   
                                                   <faultstring>#cfcatch.message#</faultstring></cfoutput>                   
                                      </soapenv:Fault>                   
                                   </soapenv:Body>                   
                                </soapenv:Envelope>                  
                           </cfsavecontent>
                    </cfcatch>
                </cftry>     
          <cfreturn soapRes >
        </cffunction>
    </cfcomponent>
    If my component is okay then may be possible some setting in ColdFusion administrator. i have checked in SoapUI as well via getSoapResponse method.

  • Deleting a Record in Database - Error Message

    Hello.
    I have made a database, where i can view, edit, add new
    records and its all working fine. I am trying to also have a delete
    feature on it. I have created the link for it to delete, and added
    the commands but im getting an error message when i hit delete
    saying :
    "The web site you are accessing has experienced an unexpected
    error.
    Please contact the website administrator.
    The following information is meant for the website developer
    for debugging purposes.
    Error Occurred While Processing Request
    Element DEPART is undefined in QARTIST.
    i have looked through my coldfusion pages over and over but i
    cant see anything which is wrong and i cant figure out what line
    there might be a mistake on! could someone inform me what this
    error message is saying to me please?
    Thanks very very very very much in advance

    Hello.
    Thanks very much for the response!
    I have searched more on the missing variable but still cant
    work out whats wrong.
    Not sure why its saying 'depart' specfically as that is the
    3rd row in the table.
    Not too sure on where to go frm here. Could i ask for a bit
    more specific help?
    I have 3 an index page which displays the 7 rows + a link to
    edit any of the returned data :
    <td>#qArtists.CurrentRow#</td>
    <td>#qArtists.FirstName#</td>
    <td>#qArtists.LastName#</td>
    <td>#qArtists.Depart#</td>
    <td>#qArtists.Hotel#</td>
    <td>#qArtists.Board#</td>
    <td>#qArtists.Price#</td>
    <td><a
    href="updateartist.cfm?artistid=#qArtists.ArtistID#">Edit</a></td>
    Then i have a :
    artist.cfc which i added the delete code to :
    <cffunction name="deleteArtist" access="public"
    returntype="void">
    <cfargument name="artistid" type="numeric"
    required="yes">
    <cfquery datasource="#application.datasource#">
    DELETE FROM artists
    WHERE ArtistID = #arguments.artistid#
    </cfquery>
    </cffunction>
    then i have a delete.cfm file
    <cfif IsDefined("form.artistid")>
    <cfinvoke
    component="cf8essentials.cfc.Artist"
    method="deleteArtist">
    <cfinvokeargument name="artistid"
    value="#form.artistid#"/>
    </cfinvoke>
    <cflocation url="/cf8essentials/artists/index.cfm"
    addtoken="no">
    </cfif>
    <cfform>
    <cfinput type="submit" name="submit" value="Delete">
    <cfinput type="button" name="cancel" value="Cancel"
    onclick="history.back()">
    <cfinput type="hidden" name="artistid"
    value="#url.artistid#">
    </cfform>
    really not sure what part im doing wrong as i have fllowed
    two different tutorials which do it different and both of theirs
    work but im not sure what ive done wrong. Could you advise further
    has ive been pulling my hair out over this for the past couple of
    days now! thanks very much in advance again!

  • Error inserting a row into a table with identity column using cfgrid on change

    I got an error on trying to insert a row into a table with identity column using cfgrid on change see below
    also i would like to use cfstoreproc instead of cfquery but which argument i need to pass and how to use it usually i use stored procedure
    update table (xxx,xxx,xxx)
    values (uu,uuu,uu)
         My component
    <!--- Edit a Media Type  --->
        <cffunction name="cfn_MediaType_Update" access="remote">
            <cfargument name="gridaction" type="string" required="yes">
            <cfargument name="gridrow" type="struct" required="yes">
            <cfargument name="gridchanged" type="struct" required="yes">
            <!--- Local variables --->
            <cfset var colname="">
            <cfset var value="">
            <!--- Process gridaction --->
            <cfswitch expression="#ARGUMENTS.gridaction#">
                <!--- Process updates --->
                <cfcase value="U">
                    <!--- Get column name and value --->
                    <cfset colname=StructKeyList(ARGUMENTS.gridchanged)>
                    <cfset value=ARGUMENTS.gridchanged[colname]>
                    <!--- Perform actual update --->
                    <cfquery datasource="#application.dsn#">
                    UPDATE SP.MediaType
                    SET #colname# = '#value#'
                    WHERE MediaTypeID = #ARGUMENTS.gridrow.MediaTypeID#
                    </cfquery>
                </cfcase>
                <!--- Process deletes --->
                <cfcase value="D">
                    <!--- Perform actual delete --->
                    <cfquery datasource="#application.dsn#">
                    update SP.MediaType
                    set Deleted=1
                    WHERE MediaTypeID = #ARGUMENTS.gridrow.MediaTypeID#
                    </cfquery>
                </cfcase>
                <cfcase value="I">
                    <!--- Get column name and value --->
                    <cfset colname=StructKeyList(ARGUMENTS.gridchanged)>
                    <cfset value=ARGUMENTS.gridchanged[colname]>
                    <!--- Perform actual update --->
                   <cfquery datasource="#application.dsn#">
                    insert into  SP.MediaType (#colname#)
                    Values ('#value#')              
                    </cfquery>
                </cfcase>
            </cfswitch>
        </cffunction>
    my table
    mediatype:
    mediatypeid primary key,identity
    mediatypename
    my code is
    <cfform method="post" name="GridExampleForm">
            <cfgrid format="html" name="grid_Tables2" pagesize="3"  selectmode="edit" width="800px" 
            delete="yes"
            insert="yes"
                  bind="cfc:sp3.testing.MediaType.cfn_MediaType_All
                                                                ({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
                  onchange="cfc:sp3.testing.MediaType.cfn_MediaType_Update({cfgridaction},
                                                {cfgridrow},
                                                {cfgridchanged})">
                <cfgridcolumn name="MediaTypeID" header="ID"  display="no"/>
                <cfgridcolumn name="MediaTypeName" header="Media Type" />
            </cfgrid>
    </cfform>
    on insert I get the following error message ajax logging error message
    http: Error invoking xxxxxxx/MediaType.cfc : Element '' is undefined in a CFML structure referenced as part of an expression.
    {"gridaction":"I","gridrow":{"MEDIATYPEID":"","MEDIATYPENAME":"uuuuuu","CFGRIDROWINDEX":4} ,"gridchanged":{}}
    Thanks

    Is this with the Travel database or another database?
    If it's another database then make sure your columns
    allow nulls. To check this in the Server Navigator, expand
    your DataSource down to the column.
    Select the column and view the Is Nullable property
    in the Property Sheet
    If still no luck, check out a tutorial, like Performing Inserts, ...
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/index.jsp
    John

  • Error executing CFC. Parameter index out of range (2 number of parameters, which is 1)

    Hi,
    My CFC component is defined as:
    <cffunction name="updateNote" output="false" access="remote"  returntype="void" >
         <cfargument name="notedetails" required="true" type="string" >
         <cfargument name="notename" required="true" type="string" />
         <cfquery name="qupdateNote" datasource="notes_db">
               UPDATE
                   notes
               SET
                   notes.notedetails=<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#ARGUMENTS.notedetails#">,
               WHERE
                   notename="<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#ARGUMENTS.notename#">"
        </cfquery>
    </cffunction>
    In Flash builder when I test the operation I get this error:
    "There was an error while invoking the operation. Check  your server settings and try invoking the operation again.
    Reason:  Server error Unable to invoke CFC - Error Executing Database Query. Parameter  index out of range (2 > number of parameters, which is 1)."
    Im really quessing that this is something small but right now its causing me to pull my hair out of my head!! Argg. Tried a bunch of things but I know thik im stuck.
    Help would be very very appreciated.
    Thanks

    Create test.cfm along these lines:
    <cfset myObj = createObject("component", "dotted.path.to.cfc.file")>
    <cfset myResult = myObj.myMethod(arg=value1, etc)>
    <cfdump var="#myResult#">
    Or, really, you could just browse to this:
    http://your.domain/path/to/your.cfc?method=yourMethod&arg1=value1 [etc]
    Although I dunno which of those two approachs will give you a better error message (indeed, it might be the same).
    Try both.
    Adam

  • 401 Unauthorized error when calling a webservice

    Have ColdFusion 11 installed, I have created a hello web service and I am trying to call it.  Each time I try to call the web service I get an error 401 Unauthorized.  I am not sure if I need to configure something more on the ColdFusion server, IIS or something else.
    <cfcomponent displayname="Hello">
    <cffunction name="helloWorld" returntype="string" access="remote">
         <cfreturn "Hello World!">
        </cffunction>
    </cfcomponent>
    <cfinvoke
      webservice="http://MyServer/Hello.cfc?wsdl"
      method="helloWorld"
      returnvariable="ws" refreshwsdl="yes">
    </cfinvoke>
    <cfdump var="#ws#">

    It appears that you have inadvertently enforced HTTP authentication. If so, you will have to include the attributes, username="your_username" and password="your_password" in the cfinvoke tag.

  • Validation error for tag cfloop

    Hi All,
    Complete newbie to CF here.  I've inherited (or bought) an online business which has its site written in CF.  I haven't done this sort of stuff before but do work SQL for a living and object oriented stuff plus have done a bit of html and php so CF isn't mind blowing to me (in its simple form).
    I've downloaded my site on to my computer to run a local copy that I can hack to pieces if needs be.  For some reason, I have a few problems with the site running locally.  The first error I'm getting is a Attribute validation error for tag cfloop.
    Basically, index.cfm has this bit of code in it:
    <cfinvoke component="#datasets#" method="storedProcedure" returnvariable="getFeaturedWineries_qry">
        <cfinvokeargument name="storedProcedure" value="usp_GetFeaturedWineries">
    </cfinvoke>
    Ok, easy enough.  Anyway, there's a call down the page to:
    <cfinclude template = "#REQUEST.CFMPath#includes/displayFeaturedWineries.cfm">
    Within displayFeaturedWineries.cfm is the code that calls the stored proc invoked above:
    <cfloop query="getFeaturedWineries_qry" startrow="1" endrow="2">
    Bam, that's where the error occurs.  "The value of the attribute query, which is currently getFeaturedWineries_qry, is invalid.
    What???  The stored proc exists and it only returns two records (which begs me to wonder why you would have startrow and endrow but anyway, it doesn't work with or without it).
    The other interesting thing is that this works on production, NO PROBLEM!!!  WTF?  How can it work on production but not locally.
    The only thing I'm starting to think is:
    a)  I've missed a setting somewhere in CF or
    b)  I'm running Apache as compared to IIS or
    c)  I'm running SQL 2008 and CF 9 which will no doubt be different to the production host server.
    Should B or C be causing THAT type of problem??
    Thanks,
    Matt

    I'm not sure what code apart from the above is going to show you what you could possibly need to solve this, but here goes.  The following is only snippets of the code, but they are the relavant snippets.  Other stored procs work.  The cfdump for getFeaturedWineries_qry shows 'usp_getFeaturedWineries'.  I know its there because I've been unable to run "EXEC usp_getFeaturedWineries" after copying it straight out of the code.  As previously stated, there are other stored procs which are running fine.
    datasets.cfc
        <cffunction name="storedProcedure">
            <cfargument name="storedProcedure" required="Yes" type="string">
            <cfstoredproc procedure = "#ARGUMENTS.storedProcedure#"
                          datasource = "#REQUEST.DSN_NAME#"
                          username   = "#REQUEST.DSN_USER#"
                          password   = "#REQUEST.DSN_PASS#"
                          returncode = "Yes">
                <cfprocresult name="storedProcedure" resultset="1">
            </cfstoredproc>
            <cfreturn storedProcedure>
        </cffunction>
    application.cfm
        <!--- DATA SOURCE VARIABLES --->
        <cfset DSN_NAME = "boutiqueWineriesTest">
        <cfset DSN_USER = "coldfusion">
        <cfset DSN_PASS = "coldfusion">
    index.cfm
    <cfobject component="#COMP_REF#.datasets" name="datasets">
    <cfinvoke component="#datasets#" method="storedProcedure" returnvariable="getFeaturedWineries_qry">
        <cfinvokeargument name="storedProcedure" value="usp_getFeaturedWineries">
    </cfinvoke>
    <cfinclude template = "#REQUEST.CFMPath#includes/displayFeaturedWineries.cfm">
    displayFeaturedWineries.cfm
             <cfloop query="getFeaturedWineries_qry" startrow="1" endrow="2">
    Attribute validation error for tag cfloop.
    The value of the attribute query, which is currently  getFeaturedWineries_qry, is invalid.                                                                                  The error occurred in C:\apps\iishome\includes\displayFeaturedWineries.cfm:  line 33
    Called from C:\apps\iishome\index.cfm: line 399
    Called from C:\apps\iishome\index.cfm: line 79
    Called from C:\apps\iishome\index.cfm: line 1
    31 :      <tr>
    32 :           <td width="626" colspan="3" class="productCenter_bg2">
    33 :          <cfloop query="getFeaturedWineries_qry" startrow="1" endrow="2">
    34 :              <div class="productCennews">
    35 :                  <table border="0" cellspacing="0" cellpadding="0">

  • WDDX packet parse error at line 1, column 1. Content is not allowed in prolog..

    We have a CFC page that was working fine before moving to CF9 from CF8.  Any ideas on why it is no longer working?  It is not processing at all now - just giving us this error.
    <cfcomponent displayname="Checks For Email Address" output="true" hint="Checks for an Existing Email">
                   <cffunction access="remote" name="CheckInData" returntype="boolean" description="Checks Email and Returns True if Email Address Exists" hint="Checks Email and Returns True if Email Address Exists">
                   <cfargument name="Email_Check" type="string" required="true"/>
                   <cfquery name="data" datasource="datasource" dbtype="OLEDB">
                SELECT                 
                                  Email
                FROM                    
                                  EmailTable
                WHERE
                                  Email=<cfqueryparam value="#Trim(arguments.Email_Check)#" cfsqltype="cf_sql_varchar" />
                AND
                                  Company_ID='#company_ID#'
            </cfquery>
            <cfif data.RecordCount EQ 0>
                   <cfreturn false>
            <cfelse>
                   <cfreturn true>
            </cfif>
        </cffunction>

    @cover,
    I see two things you might change, but I don't know if they will solve the problem.  First, you don't need the "dbtype" attribute anymore with CFQuery, unless it's dbtype="query".  Second, it's possible you have a race condition on your query results variable ("data").  You might add a line right below the CFArgument tag:
    <cfset var data = "">
    This will make the "data" variable local to the function.
    Other than that, I can't see anything obvious.  I'm not at all versed in WDDX, so maybe someone else will have some better ideas.
    -Carl V.

Maybe you are looking for

  • No "Save As" in recent Pages Update

    I just updated to Mountain Lion and the most current version of iPages.  I no longer have a "Save As" function/option in my "File" menu.  I go to help and type "Save As" and I get the handy little animated help showing it, but that menu in NO WAY res

  • Mail crash on TWO machines

    Hi....What does it mean when MAIL program crashed and then it does the same on another computer..... Yet does not crash when turn AIPORT off....? I can pick up mail on web interface version.....I suppose it could be some rogie mail, but i do not see

  • Table control in internal table

    what will b the sequence to creat module pool i.e  topinclude , pbo ,pai , screen-layout, flow logic , i m confused which sequence i follow .

  • JAXB binding list of doubles

    Hi, I have a problem in binding elements containing a list of doubles. The elements may occur many times. In the generated code, doubles from different elements are returned in the same list. Is there any way to force the creation of a new java type,

  • Where should I save .wav files?

    Is there a folder I can save them in so they show up under the sound menu on the properties tab?