hi Matthew,
that's perfect! Thanks you very much. This one had me stumped for quite some time due to issues with outputting repeat rows from a query, versus outputting what coldfusion decided (or rather what I accidentally kept telling it) was a single variable unrelated to my query.

Regards
Mark Henderson
Web Designer
mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

205 Main Street
PO Box 143, Gore
Southland 9700
Phone: (03) 203 9999
Fax: (03) 203 9900

-----Original Message-----
From: Matthew Walker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 04, 2004 1:33 PM
To: CF-Talk
Subject: RE: Using predefined variable in output query

Hi Mark,

Good to see a local in here! Assuming round1, round2, etc are columns in the
results query record set, try this:

<td>#results["round#round_number#"][currentRow]#</td>

________________________________________
From: Mark Henderson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 4 August 2004 1:24 p.m.
To: CF-Talk
Subject: Using predefined variable in output query

Good afternoon list members,
I have what I had initially thought was a relatively easy request, however
it hasn't quite proved that way, at least not just yet. With any luck I'm
missing something simple.

A working example is easiest to start with:

<cfoutput query="results">
<tr bgcolor="#IIf(CurrentRow Mod 2, DE('ffffff'), DE('cccccc'))#">
<td>#team_name#</td>
<td>#round1#</td>
<td>#total_score#</td>
</tr>
</cfoutput>

>From a previous query (results) I want to output in a table the results for
each of the columns listed above; team_name, round1, and total_score - but I
don't want to have to hard code round1, since that will depend on the round
number. This is already set as another variable (called round_number). I
guess what I'm saying is that I don't want to hard code "round1" because
sometimes it might be "round2", or "round7", so I need a way of retrieving
the info from the column round1, for instance.

However, when I try the following:

<cfoutput query="results">
<tr bgcolor="#IIf(CurrentRow Mod 2, DE('ffffff'), DE('cccccc'))#">
<td>#team_name#</td>
<td>#round("#round_number#")#</td>
<td>#total_score#</td>
</tr>
</cfoutput>

or

<cfoutput query="results">
<tr bgcolor="#IIf(CurrentRow Mod 2, DE('ffffff'), DE('cccccc'))#">
<td>#team_name#</td>
<td>#round(round_number)#</td>
<td>#total_score#</td>
</tr>
</cfoutput>

it outputs 1 repeatedly (which is the current round_number) in the middle
column. As I have outlined, this is not what I want. What I want are all
values from the column titled round1.

Another way to put it is like so:
lets assume I have a table in my database with 4 fields - team_name, round1,
round2, round3 and total_score. The current round number is 1 (for arguments
sake, and this variable is already defined as round_number) and I would like
to output for each team their score for the current round (round1) and their
total score.

Does that make sense?

All help greatly appreciated.

Regards
Mark Henderson
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to