[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

display 1st and last in group (date format)

Posted on 2003-10-28
11
Medium Priority
?
255 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
Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

 

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 500 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

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

649 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