Solved

only list certain fields in output query until those fields are selected, then auto show next fields

Posted on 2003-11-25
4
150 Views
Last Modified: 2013-12-24
this is a doozy -

my db table lists timeslots:

eg
02/04/2004 08:30:00
02/04/2004 9:00:00
02/04/2004 9:30:00
02/04/2004 14:00:00
02/04/2004 14:30:00
02/04/2004 15:00:00

02/05/2004 08:30:00
02/05/2004 9:00:00
02/05/2004 9:30:00
02/05/2004 14:00:00
02/05/2004 14:30:00
02/05/2004 15:00:00

etc

my client wants the webpage to show only the 1st am and pm slots until they're "taken" then wants to auto show the next in line so:

1st:
02/04/2004 08:30:00, 02/04/2004 14:00:00
02/05/2004 08:30:00, 02/05/2004 14:00:00

then when these are deleted (they get deleted from the table when they are "taken)

show the next 2:

02/04/2004 09:00:00, 02/04/2004 14:30:00
02/05/2004 09:00:00, 02/05/2004 14:30:00

here's my existing code:

<cfquery name="rsTimes" datasource=#MM_connCalArts_DSN# username=#MM_connCalArts_USERNAME# password=#MM_connCalArts_PASSWORD#>
SELECT count(*) as slotsremain,  timeslots_theater.timeslots, mix_theater.cities_id, cities_theater.cities,
mix_theater.timeslots_id, mix_theater.mix_id, timeslots_theater.id FROM timeslots_theater,
mix_theater, cities_theater WHERE timeslots_theater.id = mix_theater.timeslots_id
AND cities_theater.id = mix_theater.cities_id AND cities_id = '#rsTimes__MMColParam#'
group by timeslots
order by timeslots asc
</cfquery>

__________________________________________________

<cfoutput query="rsTimes" group="timeslots">
    <li><A HREF="application.cfm?#Trim(MM_keepURL & Iif(MM_keepURL NEQ '',DE('&'),DE('')) & 'mix_id=' & rsTimes.mix_id)#" class="craig">#dateformat(rsTimes.timeslots, 'mmmm d, yyyy')#&nbsp; #timeformat(rsTimes.timeslots, 'h:MM tt')#</A>
  </cfoutput>

0
Comment
Question by:phillystyle123
  • 3
4 Comments
 
LVL 11

Accepted Solution

by:
hart earned 150 total points
ID: 9822702
ok is ur data always going to be in pairs

that is total being 6 or 8 or 10 etc..

then ty this out

take this in a variable
<cfset Lst_Date = "02/04/2004 08:30:00~02/04/2004 9:00:00~02/04/2004 9:30:00~02/04/2004 14:00:00~02/04/2004 14:30:00~02/04/2004 15:00:00">

<cfloop from="1" to="#ListLen(Lst_Date,'~')#" Index="Date_Index">
    <cfif Date_Index EQ 1>
      #ListGetAt(Lst_Date,Date_Index,'~')#<br>
      #ListGetAt(Lst_Date,Evaluate(ListLen(Lst_Date,'~')/2),'~')#
    <cfelse>
      #ListGetAt(Lst_Date,Date_Index,'~')#<br>
      #ListGetAt(Lst_Date,Evaluate((ListLen(Lst_Date,'~')/2)+(Date_Index-1)),'~')#
    </cfif>
</cfloop>

i haven't tested it..
but the logic is that i am getting the first element and then dividing the length of the list by 2 which will gie the 4 th one
let me know


Regards
Hart
0
 

Author Comment

by:phillystyle123
ID: 9823802
i'll try this out hart- but it occured to me, couldn't i just use a query for AM and one for PM and then just do something like

<cfoutput query="AM" maxrows ="1">.................

<cfoutput query="PM" maxrows ="1">.................
0
 
LVL 11

Expert Comment

by:hart
ID: 9823834
yeah that would work 2.. :-)

0
 
LVL 11

Expert Comment

by:hart
ID: 9823838
but then u will have 2 queries instead of just 1

Regards
Hart
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Google Crawl Errors Producing 404 Errors 4 83
IIS 8.5 2 52
assigning port numbers to web sites and web services 2 77
wordpress email form 23 79
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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

832 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