Solved

display 1st and last in group (date format)

Posted on 2003-10-28
11
248 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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Suggested Courses

732 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