|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > A solution to pound signs inside pound signs |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|