|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Alright....I am developing chart that displays the year/month on the x-axis of a bar chart, and the y-axis is the total number incidents for all states from this data. When the user clicks on a certain bar, let's say 2004/3 (2004 March), I want to display a new bar chart that takes the data from March of 2004, and displays the individual state information for the selected month.
On my action page, I needed to display the year and month from a date/time field in my database. I did that by using DatePart. But in order to display them both in my chart, I needed to combine them, in order to do that I had to change them into strings. How do I get my detail page to work so it displays all the state information for the selected month? The query for my action page is below: <cfquery name="LoginsByAllUsers" datasource="FCNNevin"> SELECT DatePart('yyyy', LoginDate) AS Year, DatePart('m', LoginDate) AS Month, Str$(DatePart('yyyy', LoginDate)) + Str$(DatePart('m', LoginDate)) AS YearMonth, Count(*) AS Logins FROM LoginAttempt WHERE Reason = 'ValidLogin' GROUP BY DatePart('yyyy', LoginDate), DatePart('m', LoginDate), Str$(DatePart('yyyy', LoginDate)), Str$(DatePart('m', LoginDate)) ORDER BY DatePart('yyyy', LoginDate), DatePart('m', LoginDate) </cfquery> |
|
#2
|
|||
|
|||
|
I'm assuming that you are using database-specific functions where I see datePart(), etc, correct? And what is "str$"?
Does the query run when you run it from the RDBMS's command line or SQL editor?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
I am using a Microsoft Access database, which does accept the DatePart() function. When you use DatePart to pull out the month and year like I have, it gives those numbers and integer type. So inorder to combine them using the "+", you need to convert them into string...which is what str$ does. I just took my two DatePart functions and wrapped them in str$ to convert them to string type.
The query does run in the SQL View in Access, it returns the Month, Year, YearMonth, and total Logins. |
|
#4
|
|||
|
|||
|
hmm...if the query runs correctly then what exactly is the problem?
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Passing parameters in cfchart |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|