2 Replies Latest reply on Jun 5, 2009 12:01 PM by AdSol

    Bug: 1st Date value returned from CF function as an Array

    AdSol

      I am encountering an annoying behavior in Flex.  I call a CF function to return a query into an arraycollection - very basic.  If the SELECT statement in the CF function includes any dates as returned values, the first date in the SELECT statement comes back into Flex as an array object that includes all of the fields in the query.  The other dates are returned normally as Date data types.

       

      This started happening a month or two ago, and I've reproduced it on several machines.  Needless to say, it is causing numerous errors when my code excpects a Date and gets an Array.

       

      Do you have any ideas of what might be causing this and what I can do about it?

       

      Thanks!!

        • 1. Re: Bug: 1st Date value returned from CF function as an Array
          Michael Borbor Level 4

          Could you upload somewhere the source code of your test case? Not here

          because sometimes the file uploading process takes forever.

          • 2. Re: Bug: 1st Date value returned from CF function as an Array
            AdSol Level 1

            I'm not sure where to post it, but here are some snippets:

             

            in the cfc, I have a function as such:

             

            <CFFUNCTION name="GetPersonLog" returntype="query">
                <CFARGUMENT name="STUDENTID" type="numeric" required="Yes">
                <CFQUERY name="qry" datasource="#connection_string#">
                    SELECT tblStudentLog.STUDENTLOGID, tblStudentLog.STUDENTID,
                    <!---GETDATE() AS TESTTHIS,--->
                    tblStudentLog.LOGDATE,

                    tblStudentLog.LASTUPDATED,
                    tblStudentLog.LOGENTRY

                    FROM  tblStudentLog LEFT OUTER JOIN
                    tblStudentDiscipline ON tblStudentLog.StudentDisciplineID = tblStudentDiscipline.StudentDisciplineID
                    WHERE tblStudentLog.STUDENTID = <CFQUERYPARAM value = "#studentid#">
                    ORDER BY tblStudentLog.LOGDATE DESC
                </CFQUERY>
                <CFRETURN qry>
            </CFFUNCTION>

             

            You see I have a REMmed out line to get a test date.  If I check the results in CF using cfdump, all dates come back as dates.

             

            In flex, the handler for the call to this function is simple:

             

                    private function PersonLogHandler(event:ResultEvent):void{
                        personlog = event.result as ArrayCollection;
                        CursorManager.removeBusyCursor();}  

             

            If I stop the code here and evaluate the results in debug mode, I find that the LOGDATE result is an array of values, while the LASTUPDATED field is a date.

             

            If I put back the GETDATE() AS TESTTHIS, statement in the cfc function, then the result includes LOGDATE as a date object, but now the TESTTHIS result is an array.

             

            I have experienced this on 2 different machines, and it has brought my development to a standstill.  I can't thin of what changed to start these problems, except that I am now using the FlashPlayer 10 (with debugger).  This happens in Firefox and IE.  I am using FlexBuilder 3 and Coldfusion 8.