0 Replies Latest reply on Sep 19, 2010 11:39 PM by Daniel Pride

    Passing Dates to CF

    Daniel Pride Level 1

      I am trying to pass a date to a  cfc

      I test the service in Flashbuilder and it works fine when I type in a value of 09/20/2010

      It returns the numeric sum as expected....

       

      But when I try to call it nothing and I mean nothing works.

      This seems absurdly frustrating....

      Not this....

                         var theDate:Date = new Date();

                         sumDateLineItemsResult.token = lineItemsService.sumDateLineItems(theDate);

                           lineItemsService.commit();

      nor this....
                      sumDateLineItemsResult.token = lineItemsService.sumDateLineItems(new Date(2010,09,20));
                      lineItemsService.commit();

       

      The cfc

          <cffunction name="sumDateLineItems" output="false" access="remote" returntype="numeric" >
              <cfargument name="theDate" type="date" required="true" />
              <cfset var qSum="">
              <cfquery name="qsum" datasource="BlueRose">
                  SELECT SUM(Price) AS daysTotal FROM LineItems WHERE AptDate = <CFQUERYPARAM CFSQLTYPE="CF_SQL_DATE"                VALUE="#ARGUMENTS.theDate#">
              </cfquery>
              <cfif len(qsum.daysTotal) EQ 0>
                  <cfset qsum.daysTotal="0">
              </cfif>
              <cfreturn qsum.daysTotal>   
          </cffunction>

       

      Thanks

      Dan Pride