Solved

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

Posted on 2003-11-25
4
153 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 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

717 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