Thanks for all the suggestions.  I'm almost there but just have one
issue left to fix.


How can I get the MONTH(dataDateReported) to return a two character
integer?  i.e., 01-January, 02-February, 03-March, etc.  

<cfquery name="buildDropDown" datasource="extranet">
SELECT YEAR(dataDateReported) AS dateYear, MONTH(dataDateReported) AS
'dateMonth'
FROM data
GROUP BY dateYear, dateMonth
ORDER BY dataDateReported DESC
</cfquery>


<cfselect size="1" name="selectMonth" required="Yes">
  <cfoutput query="buildDropDown">
    <!---  need to return the #dateMonth# in the value as 01, 02, etc.
--->
   <option value="#dateYear#-#dateMonth#">  #MonthAsString(dateMonth)#
#dateYear#  </option>
   </cfoutput>
</cfselect>

-----Original Message-----
From: Andy Ousterhout [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 26, 2004 3:54 PM
To: CF-Talk
Subject: RE: Trying to group dates in dropdown list


Please provide us with the query you are try to get working.  I
do this with a
Select ... Year(DateField) As DateYear, Month(DateField) As
DateMonth
From tabTable
Group By Year(DateField), Month(DateField)
Order By Year(DateField), Month(DateField);

Then my loop to build drop down works perfectly.
  -----Original Message-----
  From: Ron Eis [mailto:[EMAIL PROTECTED]
  Sent: Thursday, February 26, 2004 3:15 PM
  To: CF-Talk
  Subject: RE: Trying to group dates in dropdown list

  Still having problems.  I can get the YEAR-MONTH to return and
display
  properly in the dropdown list in the proper format using LEFT
or MID but
  the query returns all entries in the database.

  I need the display to be group by YEAR then MONTH in the
dropdown list.

  Whenever I add DISTINCT or a GROUP by to the query, I get the
error
  "ByteArray objects cannot be converted to strings."

  I've checked the documentation and came up with nothing.  Has
DISTINCT
  gone extinct in MX?

  -----Original Message-----
  From: Donnie Bachan [mailto:[EMAIL PROTECTED]
  Sent: Monday, February 16, 2004 11:05 PM
  To: CF-Talk
  Subject: RE: Trying to group dates in dropdown list

  I ran across this problem using MySQL and CFMX 6.1 and dates,
I have
  been
  too lazy to figure out the root of the problem but I used the
MySQL date

  format functions to format the date before returning it to
ColdFusion
  and
  that solved the problem. If the Month and Year are stored as
part of a
  date/time type use the date format function and return the
part that you

  want.

  HTH

  ======================

  Similar to a recent post but still can't get it to work.

  Using CF MX 6.1, MySQL 3.23.44-nt, phpMyAdmin 2.4.0.

  I'm trying to group entries by month, to display MONTH YEAR in
a drop
  down list.

  Current month/year is the default display.

  User has the option to select a previous month/year which will
display
  the entries submitted during that time period.

  When using CF 5, used [[SELECT DISTINCT
LEFT(dataDateReported,7) AS
  dropDownMenu]] AND [[<cfselect name="selectMonth" size="1"
  query="buildDropDown" value="dropDownMenu"
  display="dropDownMenu"></cfselect>]] but get the following
error message
  using 6.1: "ByteArray objects cannot be converted to strings."

  Can anyone help?  Please let me know if additional information
is
  needed.  Thanks in advance!
<http://www.houseoffusion.com/banners/view.cfm?bannerid=40>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to