Skip to main content
Known Participant
September 17, 2008
Answered

How to avoid exponents in numbers

  • September 17, 2008
  • 9 replies
  • 1261 views
Hi,

I've got this error and I don't know why :

quote:

Cannot convert the value 2.48962137E9 to an integer because it cannot fit inside an integer.


this error happens in the "getData" function (arround the query) see code attached

Any idea why ? I do not see where I try to convert something to int...

thank you,

Aubry
    This topic has been closed for replies.
    Correct answer Newsgroup_User
    > <cffunction name="arrayToQuery" access="public" returntype="query"
    > output="false">
    > [etc]

    I think you need to get a datatype passed in for each column too. Most of
    CF is typless: Queries are not. This is only really an issue with QoQ, in
    situations such as the one you find yourself in now.

    --
    Adam

    9 replies

    Participating Frequently
    September 18, 2008
    Adam Cameron, Thanks for sharing answer
    Newsgroup_UserCorrect answer
    Inspiring
    September 18, 2008
    > <cffunction name="arrayToQuery" access="public" returntype="query"
    > output="false">
    > [etc]

    I think you need to get a datatype passed in for each column too. Most of
    CF is typless: Queries are not. This is only really an issue with QoQ, in
    situations such as the one you find yourself in now.

    --
    Adam
    aubwebAuthor
    Known Participant
    September 18, 2008
    The query is created from an array using this function :

    <cffunction name="arrayToQuery" access="public" returntype="query" output="false">
    <cfargument name="array" type="array" required="yes"/>
    <cfscript>
    var r = 0;
    var c = 0;
    var myArray = ArrayNew(1);
    var myStruct = StructNew();
    var myQuery = QueryNew( "" );
    var colName = ArrayNew(1);
    var colCount = 0;
    var recCount = 0;
    var columnList = "";

    myArray = arguments.array;
    myStruct = myArray[1];
    colName = StructKeyArray( myStruct );
    colCount = ArrayLen( colName );
    columnList = ArrayToList( colName );
    recCount = ArrayLen( myArray );
    myQuery = QueryNew( columnList );

    QueryAddRow( myQuery , recCount );
    for( r = 1 ; r LTE recCount ; r = r + 1 ) {
    for( c = 1 ; c LTE colCount ; c = c + 1 ) {
    QuerySetCell( myQuery , colName[ c ] , myArray[ r ][colName[ c ] ] , r );
    }
    }
    </cfscript>
    <cfreturn myQuery />
    </cffunction>
    Inspiring
    September 17, 2008
    If you dump myQ and getMetadata(myQ) does it suggest anything is an INT
    which you're not expecting to be?

    --
    Adam
    aubwebAuthor
    Known Participant
    September 17, 2008
    getMetaData(myQ) =

    1 struct
    IsCaseSensitive NO
    Name YTDOCT

    2 struct
    IsCaseSensitive NO
    Name YTDSEP

    3 struct
    IsCaseSensitive NO
    Name YTDMAR

    4 struct
    IsCaseSensitive NO
    Name QTR4

    5 struct
    IsCaseSensitive NO
    Name MAR

    6 struct
    IsCaseSensitive NO
    Name STAT

    7 struct
    IsCaseSensitive NO
    Name FYR

    8 struct
    IsCaseSensitive NO
    Name QTR1

    9 struct
    IsCaseSensitive NO
    Name MAY

    10 struct
    IsCaseSensitive NO
    Name FEB

    11 struct
    IsCaseSensitive NO
    Name DE

    12 struct
    IsCaseSensitive NO
    Name YTDJAN

    13 struct
    IsCaseSensitive NO
    Name YTDAUG

    14 struct
    IsCaseSensitive NO
    Name OCT

    15 struct
    IsCaseSensitive NO
    Name SEP

    16 struct
    IsCaseSensitive NO
    Name YTDAPR

    17 struct
    IsCaseSensitive NO
    Name YTDJUN

    18 struct
    IsCaseSensitive NO
    Name JUN

    19 struct
    IsCaseSensitive NO
    Name APR

    20 struct
    IsCaseSensitive NO
    Name YTDNOV

    21 struct
    IsCaseSensitive NO
    Name ScenarioID

    22 struct
    IsCaseSensitive NO
    Name YearID

    23 struct
    IsCaseSensitive NO
    Name JAN

    24 struct
    IsCaseSensitive NO
    Name AUG

    25 struct
    IsCaseSensitive NO
    Name YTDJUL

    26 struct
    IsCaseSensitive NO
    Name ValueID

    27 struct
    IsCaseSensitive NO
    Name QTR3

    28 struct
    IsCaseSensitive NO
    Name FXID

    29 struct
    IsCaseSensitive NO
    Name JUL

    30 struct
    IsCaseSensitive NO
    Name YTDDE

    31 struct
    IsCaseSensitive NO
    Name NOV

    32 struct
    IsCaseSensitive NO
    Name YTDMAY

    33 struct
    IsCaseSensitive NO
    Name YTDFEB

    34 struct
    IsCaseSensitive NO
    Name QTR2

    35 struct
    IsCaseSensitive NO
    Name CUSTOMACCOUNT

    Inspiring
    September 17, 2008
    aubweb wrote:
    >
    quote:

    Cannot convert the value 2.48962137E9 to an integer because it cannot fit
    > inside an integer.


    All computer systems have limits. You are apparently acceding the limit
    of what can be stored in an integer. If you must do this, you will need
    to research computer science methods to handle very large numbers.
    Inspiring
    September 17, 2008
    Hi,

    In Java the "|" denotes a "bitwise inclusive OR" opeartor which you are inputting through the JavaCast function here.

    I assume that might be reason here for giving this weird error.

    Try replacing "|" with some other character.
    aubwebAuthor
    Known Participant
    September 17, 2008
    ' | ' is not the cause of the error because this function works well in the most of cases.

    The error occurs only when the query return huge number like 2489621370....
    Inspiring
    September 17, 2008
    Hi,

    In Java the "|" denotes a "bitwise inclusive OR" opeartor which you are inputting through the JavaCast function here.

    I assume that might be reason here for giving this weird error.

    Try replacing "|" with some other character.
    Inspiring
    September 17, 2008
    Hi,

    What result you are getting when you output "goodFormula" by dumping (or) aborting immediately after this line?..

    <cfset goodFormula = JavaCast("String", goodFormula) />


    aubwebAuthor
    Known Participant
    September 17, 2008
    goodFormula = 701|0 (kind of ID)

    the query is like

    SELECT AUG as data
    FROM myQ
    WHERE
    YEARID = 2008
    AND FXID = 'Z'
    AND SCENARIOID = 6
    AND CUSTOMACCOUNT = '701|0'

    and the result must be a float number
    Inspiring
    September 17, 2008
    Hi,

    In which exact line did you encounter this error?.
    aubwebAuthor
    Known Participant
    September 17, 2008
    Line 523 in my cfc :
    quote:

    AND CUSTOMACCOUNT = '#goodFormula#'


    But I don't think it's there...