Solved

Lost among the #s

Posted on 2014-11-05
5
119 Views
Last Modified: 2014-11-11
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?
0
Comment
Question by:jdthedj
  • 2
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
rjohnsonjr earned 500 total points
ID: 40425498
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

0
 
LVL 3

Author Closing Comment

by:jdthedj
ID: 40426875
Thanks rjohnsonjr.  I had thought I needed the hashes around the query name
0
 
LVL 52

Expert Comment

by:_agx_
ID: 40432821
>> 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.
0
 
LVL 3

Author Comment

by:jdthedj
ID: 40433755
Thanks for the explanation agx - It makes more sense when you understand the reasons ;-)
0
 
LVL 52

Expert Comment

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

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question