Faye,

The way you're handling the export has a number of issues. If you don't
mind, I'll suggest a somewhat different flow to the logic. I definitely
would not use the session scope here. It's just not necessary.

But first - have you actually tested your .cfm file by placing some data
into the session scope, then seeing what comes out? Completely in isolation
from Flex?

I've never seen an attempt to create a spreadsheet this way, by simply
outputting some data and giving it a spreadsheet content type:

<cfsetting enablecfoutputonly="true" showdebugoutput="No">
       <cfheader name="Content-Disposition" value="attachment;
filename=export.xls"/>
       <cfcontent type="application/vnd.ms-
excel" reset="true"/>
       <cfscript>
               WriteOutput(session.exportData);
       </cfscript>
<cfexit />

I'm not certain, but I don't think it will work.

In your .cfm file, set session.data to something and see what you get. I'm
guessing it won't work, but I could be wrong. I've created many spreadsheets
from ColdFusion, and they always require a good bit of manipulation, or the
use of the <cfspreadsheet> tags and functions in later versions. I don't
think you can just dump the data in that way, although perhaps since it's a
struct, it'll work. I don't know. But there are certainly lots of ways in CF
to create spreadsheets from data structures cleanly, and I'd suggest using
one.

So make sure you can actually create a spreadsheet, with valid data, before
you go further.

Here's how I would suggest you make things flow:(Again, this is with the
assumption that the methods need no arguments for filtering.)

   - In your button handler, do not make a remote object call. Instead, go
   ahead and make your URLRequest to the .cfm file.
   - In your .cfm file, create an instance of your gateway and retrieve the
   data.
   - Then create an instance of your export cfc, call its method and pass in
   the data retrieved in the previous step.
   - Now do whatever's necessary to actually create everything as a
   spreadsheet.

It could be simpler - create a method in a cfc called exportCustomerData
which wraps the calls to the gateway and to the export function.

So the problem should have nothing to do with Flex. Just make a URLRequest
to a .cfm file - with parameters, if necessary - then handle all the
processing there. You can do all your testing without Flex being involved,
by calling the page directly in a browser.

Mainly, make certain you can create the spreadsheet properly from CF. That's
the key.

If none of this makes sense, or if you need more help, let me know a couple
of things:

   - what version of CF you are using, and
   - whether you've tested creating the spreadsheet in a .cfm file that way



-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340587
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to