This content has been marked as final. Show 5 replies
Do it the same way you call any other function. The fact that your argument will be a query shouldn't be an issue, just make sure you declare it as such in your cfargument tag.
How do I do it by clicking a button? The query is only available on the same page as the button.
The query is only available on the same page as the button.
No it's not. By the time a button has been displayed the CF engine has
forgotten about the query unless you did something to preserve it in a
You need to keep the difference between the server and client seperate
here and understand what happens from request to request and that by
default the web is a stateless environment.
The simplest way to do what you are wanting is to have the button make
the same request the built the original page with a simple URL parameter
that means "return CSV" and then the ColdFusion template called for the
request will build the desired file and return it as the response the
this new request.
Well, thank you for the lesson on the web stateless environment.
My whole point was to at least pass the query that IS available to the calling page...
My whole point was to at least pass the query that IS available to the
But that statement does not work in a stateless environment. The query
is NOT available to be passed.
1) A request was made to web server.
2) Web server determines request is for ColdFusion, passes request to CF.
3) CF Process request creating and using query and builds response.
4) Response is returned to web server, CF clears all data for garbage
collection and goes on to next request.
5) web server passes response to client.
6) client renders response and waits for user interaction.
7) user activates button, new request is sent to web server.
8) It all starts over again.
There is no "query" anymore by the time a user sees a button and can
click on it, unless something is done to save it in a persistent scope
so that it can be used from request to request. And even then, a new
request must be made to do something with the query.