Skip to main content
Participant
April 24, 2015
Question

Invalid data '' for CFSQLTYPE CF_SQL_INTEGER

  • April 24, 2015
  • 3 replies
  • 10348 views

Every time I enter data, I get this error report:

Invalid data '' for CFSQLTYPE CF_SQL_INTEGER

It might be related to this problem:

<cfloop collection="#cities#" item="cityID">

  products["#cityID#"] = [<cfset first = true><cfloop collection="#cities[cityID].products#" item="productID"><cfif first><cfset first = false><cfelse>,</cfif>{value:"#productID#", text:"#cities[cityID].products[productID]#"}</cfloop>];

  </cfloop>

There is a syntax error I cannot find in the line starting with product[

Can anyone help?

Thanks,

This topic has been closed for replies.

3 replies

BKBK
Community Expert
Community Expert
May 2, 2015

Rewrite the code in the following way, and you will find that there are quite a few things that don't quite match up:

<cfloop collection="#cities#" item="cityID">

products["#cityID#"] = [

<cfset first = true>

<cfloop collection="#cities[cityID].products#" item="productID">

    <cfif first>

        <cfset first = false>

    <cfelse>

        ,

    </cfif>

    {value:"#productID#", text:"#cities[cityID].products[productID]#"}

</cfloop>

];

</cfloop>

Participant
May 3, 2015

Thank you. I have already made the change. I have not been able to know if it will work, because, I have not been able to test the change yet.

But, it appears to be a great improvement.

I appreciate very much your kind assistance,

Inspiring
May 1, 2015

If the value you are passing in is empty, and your database column allows nulls, then you might want to look at the "null" attribute of the cfqueryparam tag.

Participant
May 3, 2015

I have review your answer, and you are absolutely right. I have found that I have a conflict between two programs. One is known as raw_materials_decision_action and the second is raw_materials_decision.

The first one state that the rawMat variable is a money variable, and the second, practically states it as an integer.

Except, that I do not know how to correct the second variable, in spite that I have tried.

Thank you very much.

You were very kind.

Inspiring
April 25, 2015

I don't think this error relates to that line of code.

The error you are getting means that you are trying to pass a non integer to a cfqueryparam tag which has the type of integer specified. Which means that this error will be in a "cfquery" tag.

If you log into the coldfusion administrator and look at the logs (Application.log or coldfusion-out.log) it may tell you the line number of the error making it easier to find.