I really had no starting place.  I did work off of Paul's suggestion.  Some 
more background on this is as follows:

Get a list of events

<cfquery name="getEvents" datasource="myDSN">
        SELECT Events.id, Events.unit, Events.date, Events.description, 
Events.title, Events.day, Events.time, Events.location, Events.date1, 
Events.excludeReg
        FROM EVENTS
        WHERE
        (((Events.unit='CTL' or Events.unit='Special' or Events.cosponsor like 
'%CTL%') and date >= Date() and Events.approved=YES and 
Events.advertiseWeb=YES) or
        ((Events.unit='CTL' or Events.unit='Special' or Events.cosponsor like 
'%CTL%' or Events.cosponsor like '%IUSM%') and date Is Null and 
Events.approved=YES and Events.advertiseWeb=YES))ORDER BY Events.date
</cfquery>

Obtain a count of the eventIDs as they are added to the table:
<cfquery name="q1" datasource="myDSN">
Select  count(eventID) as eventCount
>From EventAttendance
Where   eventid = <cfqueryparam cfsqltype="cf_sql_integer" 
value="#getEvents.id#" />
</cfquery>

Obtain the maximum attendees allowed to event:
<cfquery name="q2" datasource="myDSN">
Select  max 
>From    Events 
Where   id = <cfqueryparam cfsqltype="cf_sql_integer" value="#q1.eventCount#" 
/> 
</cfquery> 

Output the list of events with logic to determine if the event is full:
<cfoutput query="getEvents">
  <cfset num=num+1>
  <p><strong>#title#</strong></p>
    <table width="100%" border="0" cellpadding="5">
      <tr>
        <td width="70%">
          <cfif q1.eventCount gte q2.max>
            <p>Full Event</p>
          <cfelse>
            <p>#q2.max#-#q1.eventCount# spots left</p>
          </cfif> 
          <p>When:  #DateFormat(date, "full")# | #time# <br />
             Where: #location</p></td>                                          
                                        
        <td width="30%">
          <cfif excludeReg NEQ "yes">
            <div id="on#num#"<a href="javascript: expandCollapse('expand#num#', 
'on#num#');">Details and Registration</a>
          <cfelse>
            <div id="on#num#"<a href="javascript: expandCollapse('expand#num#', 
'on#num#');">Details</a>
          </cfif>
          <br />
        </td>
      </tr>                     
    </table>
    <div id="expand#num#" style="display: none;">
    <p class="eventText">#description#</p>
      <cfif excludeReg NEQ "yes">
        <p><a href="eventsregistration.asp?id=#id#">Register for the event 
above</a>     
      <cfelse>
      </cfif>
      <a href="javascript: expandCollapse('expand#num#', 'on#num#');" 
title="Close Details">Close details</a></p>
    </div>
    <hr />
</cfoutput>

I'm not certain if the logic to determine if the events are full is correct as 
the all display that the event is full.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4429
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to