1 Reply Latest reply on Dec 8, 2006 5:39 AM by dempster

    matching times

    macca2727
      Hi i have a output which lists increments of times in the first column of a table in the second column i want to show appointment from my database that matches the time displayed

      ie

      8:00 paul
      9:00
      10:00 john
        • 1. Re: matching times
          dempster Level 1
          It looks like your time is a text string rather than a date/time field. Is that right? That can make it harder.

          Your idea of a loop is okay, but you'd want to start by creating a time object for the start time, then convert it into a string. You'd also want to query the database inside the loop, to get the names of the matching start time.

          <CFLOOP INDEX="hour" FROM="8" TO="22">
          <CFSET StartTime=CreateTime(hour, 0, 0)>
          <CFQUERY NAME="GetClients" DATASOURCE="iluvcricket">
          SELECT * FROM Appoint_Table c
          WHERE c.Time_ID = '#TimeFormat(StartTime, "hh:mm")#'
          </CFQUERY>

          Here you display the time, then the clients

          </CFLOOP>