?
Solved

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

Posted on 2003-11-25
4
Medium Priority
?
155 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
[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
  • 3
4 Comments
 
LVL 11

Accepted Solution

by:
hart earned 600 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

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 …
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 …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

752 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