Lost among the #s

jdthedj
jdthedj used Ask the Experts™
on
I have a function for generating a spreadsheet and it works fine.  I use the following code to call it

<CFOUTPUT>
<CFSET K=GenerateSpreadsheet("Freddi","#GetNames#")>
#K#
</CFOUTPUT>

How do I rewrite it as

<CFOUTPUT>
#GenerateSpreadsheet("Freddi","#GetNames#")#>
</CFOUTPUT>

without the hashes around GetNames causing a problem?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I wouldn't think that would throw an error but you can do this:

<CFOUTPUT>
#GenerateSpreadsheet("Freddi",GetNames)#
</CFOUTPUT>

Open in new window


I think your issue was the ending >
<CFOUTPUT>
#GenerateSpreadsheet("Freddi","#GetNames#")#>
</CFOUTPUT>

Open in new window

Author

Commented:
Thanks rjohnsonjr.  I had thought I needed the hashes around the query name
Most Valuable Expert 2015

Commented:
>> I had thought I needed the hashes around the query name

Only because you put quotes around the variable name. When you do that, CF doesn't know GetNames is a variable. It won't evaluate it unless you put # signs around it.  So if you skip the quotes, you don't need the # signs.

Author

Commented:
Thanks for the explanation agx - It makes more sense when you understand the reasons ;-)
Most Valuable Expert 2015

Commented:
Yep. The real problem was the trailing ">", but I figured an explanation of the # sign stuff wouldn't hurt either :).

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start Today