I am not totally understading the purpose, mostly because of my short
attention span, but remember that queries can be referenced as arrays. You
say this is a dynamically generated "table", so I am assuming this data
comes from a query. If so all of your data is already stored in an array for
you.
You can reference each cell like so:
Queryname.Columnname[row of query]
hth (because it might not ;-))
jon
----- Original Message -----
From: "Brent Goldman" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Saturday, January 13, 2001 11:30 PM
Subject: Re: querying a database for events in a resource scheduler (like a
calendar)
> Hi,
>
> That is a really good idea, but the table is dynamically generated. The
> cells are not generated through a loop of 1 through 168; they are
generated
> through a loop of how many rows there are (24; each half-hour for 12
hours)
> within an interior loop of how many columns there are (7). How can I
check
> within each cell against the variables? Maybe storing all of the
variables
> in a single array or structure would be an easier way to organize the
> variables, but what number (or a key in structures) would be checked upon
> during the generation of the table?
>
> -Brent
>
>
> >From: David Shadovitz <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: CF-Talk <[EMAIL PROTECTED]>
> >Subject: Re: querying a database for events in a resource scheduler (like
a
> >calendar)
> >Date: Sat, 13 Jan 2001 19:53:33 -0800
> >
> >How about this?
> >
> >1. Initialize the value of each cell to null:
> ><cfloop from="1" to="168" index="iCell">
> > <cfset tmp = SetVariable("cell#iCell#", "")>
> ></cfloop>
> >
> >2. Do one query to get all events.
> >
> >3. Loop through the events. For each event, determine what cell it
> >belongs in, and update the value of that cell.
> >
> >4. Build the table in a loop, putting the value #cell#iCell# into each
> >cell.
> >
> >-David
> >
> >On Fri, 12 Jan 2001 19:00:10 -0800 "Brent Goldman" <[EMAIL PROTECTED]>
> >writes:
> > > Hi,
> > >
> > > I am currently developing a resource scheduler. The table that
> > > outputs each
> > > schedule has 24 rows on the left: 12 hours with half-hour
> > > increments. There
> > > are 7 columns on the top: one for each day of the week. Total,
> > > there will
> > > be 24*7=168 different cells which need to be populated with events
> > > if there
> > > are any.
> > >
> > > There are two different ways to accomplish this. One way is to do a
> > > query
> > > to the database in each and every cell, but 168 queries is a
> > > tremendous
> > > amount of queries for one page load. If there are 10 events in the
> > > database, the page load is about 600 ms with SQL Server.
> > >
> > > The second way to accomplish this is do have a master query at the
> > > top of
> > > the page that retrieves each and every element in the database
> > > relevant to
> > > the current page. Then, within each cell, do a CFOUTPUT or CFLOOP
> > > through
> > > the query, and if the data is the one we want, output the results.
> > > This
> > > way, if there are 10 events in the database, and there are 168 loops
> > > (one
> > > loop for each cell), there is a total of 168*10=1680 times the if
> > > statement
> > > (and possibly the code within the if statement) is executed.
> > > Overall, the
> > > page load of this way is about 700 ms with SQL Server, with about
> > > 10-20 ms
> > > added for each event added into the database.
> > >
> > > The first way is definately better for page load and scalability,
> > > but it is
> > > not very efficient to have 168 queries for a single page load. Does
> > > anyone
> > > have any comments about the two different ways or new ideas on how
> > > to
> > > accomplish this project?
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists