[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cgiapp] creating a .csv file...


yep.. thats much like what I am now planning..

excellent.. it'll take a while to put all the DBI queries into small subs,
but it will be worth it in the end..

I can think of a couple of other ways I could achive the same thing, but
this way will be readable to my offsider, who is rather new to perl...

Thanks everyone.. you have been most helpful.


rgds

Franki

-----Original Message-----
From: Jeff MacDonald [mailto:suppressed
Sent: Wednesday, 12 February 2003 3:43 AM
To: Franki; suppressed
Subject: RE: [cgiapp] creating a .csv file...


fair enough about using CSV's :)

I only use excel cause that's what my clients ask for.

----

I submit this for comments.

sub formCSV {
 # takes an array of column headings
 # take a datastructure, ie $sth->fetchallarrayref({});
 format it all into .csv string.
}

sub sampleRunmode {
  do authenticaion and all that jazz that you need to do.

  if ($query->param('csv') == 1) {
    my $content = formCSV($headers,$resultset);
    return $content;
  }

  # do the rest here, that you would normally do if they
  # didn't want csv.
}

does this make sense ?

> -----Original Message-----
> From: Franki [mailto:suppressed
> Sent: Tuesday, February 11, 2003 2:38 PM
> To: suppressed
> Subject: RE: [cgiapp] creating a .csv file...
>
>
> Nah,
>
> I choose CSV because I don't want any format that isn't standard...
>
> CSV is fine for my purposes.. and I don't want it opening excel
> on someones
> PC...
>
> I'd rather they just downloaded the file..
>
> Also, its not the download itself that I am concerned about..its a way to
> create a sub or runmode that can receive a query as input..,
> generate a csv
> file then start the download using reusable code for all the runmodes that
> need to offer a download button..
>
> I am wondering if this is the easiest way to do it..
>
> but thanks for the tip, I now know how to create xls files if I
> ever get the
> desire to. :-)
>
>
> rgds
>
> Franki
>
> -----Original Message-----
> From: Jeff MacDonald [mailto:suppressed
> Sent: Wednesday, 12 February 2003 3:29 AM
> To: Franki; suppressed
> Subject: RE: [cgiapp] creating a .csv file...
>
>
> hi,
>
> why not just make a run mode that generates the excel sheet
> using Spreadsheet:Writeexcel [i think]
>
> then just send the excel mime header and spit the excel out
> on STDOUT.
>
> this what i do.
>
> jeff.
>
> > -----Original Message-----
> > From: Franki [mailto:suppressed
> > Sent: Tuesday, February 11, 2003 2:22 PM
> > To: suppressed
> > Subject: [cgiapp] creating a .csv file...
> >
> >
> > Hi guys,
> >
> > I have a rather nice app running now with CGI::App, HTML::temp and
> > CGI::Sess...
> >
> > It displays fairly large chunks of data from a mysql db.
> (sometimes up to
> > 1500 lines of data.)
> >
> >
> > Anyway, I now have a small problem and I was wondering if you guys had a
> > suggestion...
> >
> >
> > I need to put a link on the DB displays where they can download
> > the data in
> > csv format (comma seperated values so the winblows newbies get an
> > excel icon
> > appear when the download it.)
> >
> > Anyway, I don't want to create the file unless they are gonna use it..
> > because it will take resources to create a file that might not be
> > used, and
> > its slowish already.. (need to upgrade the server soon.)
> >
> > I thought about creating a runmode for the csv that receives
> the relevant
> > query data from the runmode that refered to it... and does the
> > query again,
> > this time printing to file while in the fetchrow loop... then print a
> > download header and start the download...
> >
> > I am thinking there might be an easier way to do this, but not
> > sure what it
> > is...
> >
> > Does anyone have any suggestions here???
> >
> >
> > There are currently ten screens that will require a download
> link, so I'd
> > like to write reusable code so all of them just use the same sub or
> > runmode...
> >
> > What have you guys done in cases like this???
> >
> >
> > rgds
> >
> > Frank
> >
> >
> > ---------------------------------------------------------------------
> > Web Archive:  http://www.mail-archive.com/suppressed/
> > To unsubscribe, e-mail: suppressed
> > For additional commands, e-mail: suppressed
> >
> >
>
> ---------------------------------------------------------------------
> Web Archive:  http://www.mail-archive.com/suppressed/
> To unsubscribe, e-mail: suppressed
> For additional commands, e-mail: suppressed
>
>
>
> ---------------------------------------------------------------------
> Web Archive:  http://www.mail-archive.com/suppressed/
> To unsubscribe, e-mail: suppressed
> For additional commands, e-mail: suppressed
>
>


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed



---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.