ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 19th, 2005, 08:36 PM
NightVa NightVa is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 67 NightVa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 31 m 33 sec
Reputation Power: 5
A solution to pound signs inside pound signs

Hi all,

Some of my query structure changes using a variable that is filled in depending on a preceeding switch/case condition.

Since the database tables follow a file naming standard I can just change that one variable and call any table depending on the situation.

Example: tbl_boysTeamInfo OR tbl_girlsTeamInfo I can change the boys or girls text and call a different table using that same query.

Now...the variable I create is called "SQLtable", as in <cfset SQLtable="boys"> OR <cfset SQLtable="girls"> depending on the case value.

This is where my question comes in.
I then create a query output loop that calls on a specific column in the table AND uses the SQLtable variable to dynamically change the specific column name.

Example:
<cfoutput query="qteamInfo">
#qTeamInfo.Afld_#SQLtable#TeamInfo_name#
</cfoutput>

I don't know how to make the pound signs/cfoutput combination work in this example...

Am I just way off base on this one?

Nathan

Reply With Quote
  #2  
Old April 19th, 2005, 09:09 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,681 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 22 m 41 sec
Reputation Power: 53
You could use evaluate:

<cfoutput query="qteamInfo">
#evaluate( 'qTeamInfo.Afld_#SQLtable#TeamInfo_name' )#
</cfoutput>

But evaluate is slow so it should be avoided if possible. You should also be able to do this using the "array syntax" for a query result set:

<cfoutput query="qteamInfo">
#qTeamInfo['Afld_#SQLtable#TeamInfo_name'][qteamInfo.currentRow]#
</cfoutput>
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > A solution to pound signs inside pound signs


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT