Solved

display 1st and last in group (date format)

Posted on 2003-10-28
11
243 Views
Last Modified: 2013-12-24
<cfoutput  group="CalendarDate"><cfif #Recurring# is "yes">#dateformat(CalendarDate,'mmmm d, yyyy')#<cfelse>sdfsdf</cfif></cfoutput>

i need to be able to display the 1st and last date (this is part of <cfoutput query="LastName"> so i can't use output query.
0
Comment
Question by:phillystyle123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 1

Expert Comment

by:rstorey2079
ID: 9636450
You need to post more information.  What is not working? What is the structure of the query result set that you are trying to output?
0
 

Author Comment

by:phillystyle123
ID: 9637288
funny, i was just getting ready to do that when i got your comment -

in the code below i have  group="CalendarDate" nested in <cfoutput query="eventtypes" group="Eventname">

my query:
<cfquery name="eventtypes" datasource="#dsn#">
      select ETImage, ETImageOver, EventID,GrayNote, Eventname, ETHeaderImage, ETDesc, EventImage, CalendarDate, Subtitle, LongName, Recurring from eventtypes, calendar
      where calendar.EventType=EventID AND EventID = "#url.EventID#"
            order by CalendarDate Asc</cfquery>

my output:
<cfoutput query="eventtypes" group="Eventname">......
<cfoutput  group="CalendarDate"><cfif #Recurring# is "yes">#dateformat(CalendarDate,'mmmm d, yyyy')#<br><cfelse>#dateformat(CalendarDate,'mmmm d, yyyy')#</cfif></cfoutput>

if <#Recurring# is "yes"> is true there are at least 2 usually more dates listed.  

i need to show ONLY the 1st and last recurring date for each Eventname.  AND instead of

January 28, 2004
January 31, 2004

my formatting has to output this:

January 28-31, 2004

if it crosses over a month it has to look like this:


October 28-November 2, 2003
0
 
LVL 15

Expert Comment

by:danrosenthal
ID: 9637468
try this one...

<cfoutput query="eventtypes" group="Eventname">
      <cfoutput  group="CalendarDate">
            <CFSET startdate = 0>
            <CFIF Recurring is "yes">
                  <CFIF startdate neq 0>
                      <CFSET startdate = CalendarDate>
                  <CFSET>
                      <CFSET enddate = CalendarDate>
                  </CFIF>
            </CFIF>
      </cfoutput>
      RANGE:
      <CFIF month(startdate) eq month(enddate) >
      #dateformat(startdate,'mmmm')# #dateformat(startdate,'d')#-#dateformat(startdate,'d, yyyy')#
      <CFELSE>
      #dateformat(startdate,'mmmm d')#-#dateformat(startdate,'mmmm d, yyyy')#
      </cfif>
</cfoutput>
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:phillystyle123
ID: 9637887
i got this error:

Error Diagnostic Information
Attribute set validation error in tag CFSET

The tag has an invalid attribute combination: the following required attributes have not been provided: (INSIDETEXT).

The error occurred while processing an element with a general identifier of (CFSET), occupying document position (510:16) to (510:22).

The specific sequence of files included or processed is:
/usr/local/etc/httpd/htdocs/calartsweb/redcat/calendar/series.cfm      

0
 
LVL 15

Expert Comment

by:danrosenthal
ID: 9637943
which line of code relates to your line 510?
0
 

Author Comment

by:phillystyle123
ID: 9638026
looks like line 510 was this:

<CFSET>

i got rid of it and now i'm getting this error:

An error occurred while evaluating the expression:


 month(startdate) eq month(enddate)



Error near line 515, column 28.
--------------------------------------------------------------------------------

Error resolving parameter ENDDATE

0
 
LVL 15

Expert Comment

by:danrosenthal
ID: 9638051
oh...CFSET should have been CFELSE, and enddate is not getting set all the time....
so just try this one instead..

<cfoutput query="eventtypes" group="Eventname">
     <cfoutput  group="CalendarDate">
          <CFSET startdate = 0>
          <CFIF Recurring is "yes">
               <CFIF startdate neq 0>
                   <CFSET startdate = CalendarDate>
                   <CFSET enddate   = CalendarDate>
               <CFELSE>
                   <CFSET enddate   = CalendarDate>
               </CFIF>
          </CFIF>
     </cfoutput>
     RANGE:
     <CFIF month(startdate) eq month(enddate) >
     #dateformat(startdate,'mmmm')# #dateformat(startdate,'d')#-#dateformat(startdate,'d, yyyy')#
     <CFELSE>
     #dateformat(startdate,'mmmm d')#-#dateformat(startdate,'mmmm d, yyyy')#
     </cfif>
     <BR>
</cfoutput>
0
 
LVL 15

Expert Comment

by:danrosenthal
ID: 9638067
ignore that last post...try this one...

<cfoutput query="eventtypes" group="Eventname">
     <CFSET startdate = 0>
     <CFSET enddate = 0>
     <cfoutput  group="CalendarDate">
          <CFIF Recurring is "yes">
               <CFIF startdate eq 0>
                   <CFSET startdate = CalendarDate>
                   <CFSET enddate   = CalendarDate>
               <CFELSE>
                   <CFSET enddate   = CalendarDate>
               </CFIF>
          </CFIF>
     </cfoutput>
     RANGE:
       <CFIF ISDATE(startdate) AND ISDATE(enddate)>
           <CFIF month(startdate) eq month(enddate) >
           #dateformat(startdate,'mmmm')# #dateformat(startdate,'d')#-#dateformat(startdate,'d, yyyy')#
           <CFELSE>
           #dateformat(startdate,'mmmm d')#-#dateformat(startdate,'mmmm d, yyyy')#
           </cfif>
      <CFELSE>
            (Not Valid)
      </cfif>
      <BR>
</cfoutput>
0
 

Author Comment

by:phillystyle123
ID: 9638103
i think you're getting really really close here:

for dates that aren't recurring my ouput looks like this:

RANGE: (Not Valid)


John Oswald and the Rascali Klepitoire

for recurring dates i'm getting:

RANGE: May 1-1, 2004


Indian and American Creative Crossover  (it should be May 1 and May 2)

the formatting is perfect though.
0
 
LVL 15

Accepted Solution

by:
danrosenthal earned 125 total points
ID: 9638191
one more stab at it...

<cfoutput query="eventtypes" group="Eventname">
      <CFSET startdate = 0>
      <CFSET enddate = 0>
      <cfoutput  group="CalendarDate">
            <CFIF startdate eq 0>
                  <CFSET startdate = CalendarDate>
                  <CFSET enddate   = CalendarDate>
            <CFELSE>
                  <!--- not sure if this recurring check is necessary, feel free to remove it --->
                  <CFIF Recurring is "yes">
                        <CFSET enddate   = CalendarDate>
                  </CFIF>
            </CFIF>
      </cfoutput>
      RANGE:
      <CFIF ISDATE(startdate) AND ISDATE(enddate)>
            <CFIF startdate eq enddate>
                  #dateformat(startdate,'mmmm d, yyyy')#
            <CFELSEIF month(startdate) eq month(enddate)>
                  #dateformat(startdate,'mmmm d')#-#dateformat(enddate,'d, yyyy')#
            <CFELSE>
                  #dateformat(startdate,'mmmm d')#-#dateformat(enddate,'mmmm d, yyyy')#
            </cfif>
      <CFELSE>
            (Not Valid)
      </cfif>
      <BR>
</cfoutput>
0
 

Author Comment

by:phillystyle123
ID: 9640862
you got it dan!!!!!!!!  thanks so much for the help - truly appreciated - worked perfectly!!!!
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Citrix Web Interface 5.4 logon section customization 2 92
LAMP problem identifier tool ? 9 126
CFFILE upload help 98 195
Customising IE behaviour on certain pages 2 61
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question