3 Replies Latest reply: Jun 7, 2014 7:01 AM by BKBK RSS

    how to output to correct month and year using group?

    no_name_123 Community Member

         From the query GetTotalStars i get the correct data:

      resulst_1.PNG

       

      So right now im oupting the results depending on the month , and i have another query that

      gets me the months:

      months.PNG

       

       

       

      select distinct [month] from GetTotalStars order by [month],
      

       

      But the problem is that is not all the totalstars is outputing to the correct month.

      How will i be able to output the results in the correct month and year,

      since right now i only have 2014 data, but obviously someday i will have 2015.

      so will be like having two different tables 2015 and 2014.

       

      <thead>
              <tr>
                  <th>Department</th>
                  <cfoutput query="qryMonths">
                      <th>#MonthAsString(qryMonths.month)#</th>
                  </cfoutput>
              </tr>
          </thead>
              <tbody>
                  <cfoutput query="GetTotalStars" group="csedept_name">
                      <tr>
                          <td >#GetTotalStars.csedept_name#</td>
                          <cfoutput group="month" >
                              <td>#GetTotalStars.totalstars#</td>
                          </cfoutput>
                      </tr>
                  </cfoutput>
              </tbody>
          </table>
      
        • 1. Re: how to output to correct month and year using group?
          Carl Von Stetten Community Member

          @no_name_123,

           

          This looks like the same question that was posted on StackOverflow here.  Did none of the answers already provided there solve your problem?  If not, then you need to add comments there explaining why - then the people already invested in providing assistance can fine tune their answers for your and any future user's benefit.

           

          Cross-posting to multiple forums without referencing the other posts is generally considered poor form.  It's fine cross-posting if you don't get a response in the other forums, or if you simultaneously cross-post and then provide links to the other posts, but please don't waste people's time cross-posting if you already getting assistance elsewhere.


          Thanks,

          -Carl V.

          • 2. Re: how to output to correct month and year using group?
            BKBK MVP

            @No_name_123

            There you go again. You seem to focus only on what you want to have, and rarely acknowledge the suggestions you receive. You not only withhold information, you have the habit of creating a lot a duplication, hence waste.

             

            Please, have some manners and learn to share. As Carl says, discussions that share sources and contain as much information as possible will help others, besides just you.

            • 3. Re: how to output to correct month and year using group?
              BKBK MVP

              I have had a look at your previous posts. The following code will give you the value of the current year dynamically:

               

              <cfoutput>#year(now())#</cfoutput>