Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable in variable

Status
Not open for further replies.

muehlviertler

Programmer
Aug 23, 2001
9
AT
The problem looks so: I want to dispatch a mail text which comes from database.In this mail text are variables.

<cfquery name=&quot;i&quot; datasource=&quot;#dsn#&quot;>
select langtext from TableB where nr = '1'
</cfquery>

<cfquery name=&quot;t&quot; datasource=&quot;#dsn#&quot;>
select * from TableA where anderenr = '1'
</cfquery>

<cfmail to=&quot;ksc@qubus.net&quot; from=&quot;me&quot; subject=&quot;anything&quot;>
#i.longtext#
</cfmail>

In *i.longtext * are again variables. Then these variables are not dissolved how I can solve this that are dissolved the variables in a variable?



 
<cfmail> works just like <cfoutput>, so in the mail your code generates, the value of i.longtext will be displayed, not #i.longtext#. Looks to me like your code will work, test it. Good luck.

<webguru>iqof188</webguru>
 
How about:

<cfmail to=&quot;ksc@qubus.net&quot; from=&quot;me&quot; subject=&quot;anything&quot;>
#evaluate(i.longtext)#
</cfmail>
 
Thanx to iqf188 and gunawandjon, but both of you are wrong, because I get #i.longtext# from the database and in this longtext i get are also variables, you understand?

When i sent it, it looks like: my text my text #variable# my text my text #varible#.

it`s because coldfusion runs once.
Please help me
Thanx
 
The only way that I can think of doing it is using one of the Replace functions. If you have several variables, you could use the ReplaceList() function.

Assumptions:
i.longtext = &quot;And the #variable1# jumped over the #variable2#&quot;

<CFSET variable1 = &quot;cow&quot;>
<CFSET variable2 = &quot;moon&quot;>

<cfquery name=&quot;i&quot; datasource=&quot;#dsn#&quot;>
select langtext from TableB where nr = '1'
</cfquery>

<cfmail to=&quot;ksc@qubus.net&quot; from=&quot;me&quot; subject=&quot;anything&quot;>
#ReplaceList(i.longtext, &quot;##variable1##,##variable2##&quot;, &quot;#variable1#,#variable2#&quot;)#
</cfmail>

Would email:
And the cow jumped over the moon - tleish
 
try this way...
if this does not solve, let me know.
GoSooJJ

<cfquery name=&quot;i&quot; datasource=&quot;#dsn#&quot;>
select longtext from TableB where nr = '1'
</cfquery>
<cfif i.recordcount>
<cfset longtext = i.longtext>
</cfif>

<cfquery name=&quot;t&quot; datasource=&quot;#dsn#&quot;>
select * from TableA where anderenr = '1'
</cfquery>

<cfmail to=&quot;ksc@qubus.net&quot; from=&quot;me&quot; subject=&quot;anything&quot;>
#longtext#
</cfmail>
 
Hi GoSooJJ!

It`s almost the same probleme!
Thanx for your answer but there are also the variables in the mailtext!

Servus
 
- in your original script, try adding output tags, e.g.:

<cfmail to=&quot;ksc@qubus.net&quot; from=&quot;me&quot; subject=&quot;anything&quot;>
<output>
#i.longtext#
</output>
</cfmail>

- second solution try using evaluate:
cfset newValue=Evaluate(&quot;#i.longtext&quot;) Sylvano
dsylvano@hotmail.com

&quot;every and each day when I learn something new is a small victory...&quot;
 
Oh, nothing to thanx at all!

The pleasure was on my side. Hope this helps you.

sl,

....
 
The solution:


<cfquery name=&quot;i&quot; datasource=&quot;#dsn#&quot;>
select langtext from TableB where nr = '1'
</cfquery>

<cfquery name=&quot;t&quot; datasource=&quot;#dsn#&quot;>
select * from TableA where anderenr = '1'
</cfquery>

<cfset a = #de(&quot;#i.longtext#&quot;)#>
<cfset b = #evaluate(&quot;#a#&quot;)#>

<cfmail to=&quot;ksc@qubus.net&quot; from=&quot;me&quot; subject=&quot;anything&quot;>
#b#
</cfmail>

Thanx for all!

 
Oh, I'm really glad, that you have now the solution of your problem.

Maybe we can help you another time.

sl,
Innu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top