Re: [U2] Pushing csv

2007-11-13 Thread Charles Barouch

All,
   Once again, this list has provided me with excellent answers. I just 
implemented the new changes successfully and have a happy client. Thank 
you to all responders.


  - Chuck
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Pushing csv - solution and [AD] Real spreadsheets

2007-11-09 Thread Tony G
> From: Dave Walker
> We automatically send CSV-formatted ASNs (Advance Ship 
> Notices), ...that, to the user, appears to be an
> Excel spreadsheet.

NebulaXLite generates real formatted Excel spreadsheets from BASIC. The
documents can also be opened from OpenOffice and Google Docs.  You don't
need Excel at all, and it's much better than a CSV.

Apropos to this thread, rather than pushing CSV to a browser, rap the data
in HTML. A simple table will do - do not include HTML or BODY tags, start
with TABLE. Then use ContentType:
  application/vnd.ms-excel

Other MIME types to try:
  application/excel
  application/x-excel
  application/x-msexcel

With NebulaXLite, just save the file to a web server as .xls.  When the
user opens it with a plain link, it opens with Excel in the browser in edit
mode.  Click the example on the page below.

Tony Gravagno
Nebula Research and Development
http:// remove.pleaseNebula-RnD.com/products/xlite.htm
http:// remove.thisNebula-RnD.com/forum
(See notes about Excel to MV too, including free source code)
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Pushing csv

2007-11-09 Thread Glen Batchelor
Chuck,

 If you don't send the Content-length, the browser will have no idea how
much data it should expect during download. If you want the transfer size to
be shown during download then you need to provide the total Content-length
of the HTTP message body. Remember: this includes ALL characters in the body
after the first CRLF that starts the body section of the
response(CR,LF,FF,etc).

DATA<1>="1,2,3,4"
DATA<2>="5,6,7,8"

 If DATA<1> and DATA<2> are sent to the browser with UV adding CRLF combos
for each attribute of DATA then the total Content-length would be 18. 14 for
the visible chars and 4 for both CRLF combos. If you notice your download
coming up short on a few characters, then check your content length
calculator.

 As far as forcing a download, just set the MIME-type to a bogus application
value. Content-type: application/keyally. The browser will prompt the user
to determine how to handle the "keyally" document type. To take this a step
further, you could write your own CSV import utility for the O/S and update
the O/S file handling to match. Set file types of .keyally and also MIME
types of application/keyally to open with .


Glen Batchelor
IT Director
All-Spec Industries
 phone: (910) 332-0424
   fax: (910) 763-5664
E-mail: [EMAIL PROTECTED]
   Web: http://www.all-spec.com
  Blog: http://blog.all-spec.com


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:owner-u2-
> [EMAIL PROTECTED] On Behalf Of Rex Gozar
> Sent: Thursday, November 08, 2007 5:43 PM
> To: u2-users@listserver.u2ug.org
> Subject: Re: [U2] Pushing csv
> 
> Charles,
> 
> To have the browser treat your data stream as a download, you need to
> set the HTTP header "Content-type: application/download".  This needs to
> be set in the "header", not the  section.
> 
> Universe has the setRequestHeader() function, but the documentation is
> not clear on how to set the body of the data.
> 
> Normally, an HTTP response is pretty straightforward:
> 
> 001: Content-type: application/download
> 002:
> 003: some,comma,delimited,data
> 004: some,comma,delimited,data
> 
> Omit the line numbers.  The HTTP header is separated from the content
> using a blank line (linefeed).  I don't think any other headers are
> required (but I could be wrong.) "Content-length" is nice to have.
> 
> Note that you can experiment with other mime-types to get the download
> to open in an application.
> 
> rex
> ---
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Pushing csv

2007-11-09 Thread Dave Walker
We automatically send CSV-formatted ASNs (Advance Ship Notices), but use the
following to send them as an attachment that, to the user, appears to be an
Excel spreadsheet. Some of the more informative lines would be:

027: MAIL.TO.EMAIL<1,1> =  
'[EMAIL PROTECTED]'
028: MAIL.TO.NAME<1,1> = 'ASN List'
029: MAIL.SUBJECT = "ASN for ":OCONV(DATE(), "D2/")
030: MAIL.CONTENT.TYPE<1,1> = 'text/plain'

031: MAIL.HEADER.USE = 'DEFAULT-ONLY'

032: MAIL.MULTIPART = 'Y'

033:

034: *   Send generated spreadsheet via email

035: MAIL.TEXT<1,1,1> = 'EDI ASN for ':OCONV(DATE(), "D2/")

036: MAIL.TEXT<1,1,1> := ". Please send any comments to
[EMAIL PROTECTED]"  
037: MAIL.TEXT<1,2> = ''

038: MAIL.CONTENT.TYPE<1,2> = 'application/vnd.ms-excel'
039:READV HOME.PATH FROM CONTROL,'HOMEPATH',1 ELSE

040:   HOME.PATH = "/export/home/ftptrans"

041:END

042: MAIL.ATTACH.FILES<1,2> = HOME.PATH:'/':SPRDSHT.NAME

We then call a generic subroutine, SEND.MIME.EMAIL, that attaches the
generated CSV file and bangs directly on the mail server to send it out.
 
Hope this helps. If you'd like more details, contact me off list and I'll be
happy to answer questions.
--
Dave Walker
Programmer/Analyst
Ivy Hill - Louisville
(502) 473-2811

*IBM Certified Solutions Expert
*U2 Family Application Development
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Pushing csv

2007-11-08 Thread Rex Gozar

Charles,

To have the browser treat your data stream as a download, you need to 
set the HTTP header "Content-type: application/download".  This needs to 
be set in the "header", not the  section.


Universe has the setRequestHeader() function, but the documentation is 
not clear on how to set the body of the data.


Normally, an HTTP response is pretty straightforward:

001: Content-type: application/download
002:
003: some,comma,delimited,data
004: some,comma,delimited,data

Omit the line numbers.  The HTTP header is separated from the content 
using a blank line (linefeed).  I don't think any other headers are 
required (but I could be wrong.) "Content-length" is nice to have.


Note that you can experiment with other mime-types to get the download 
to open in an application.


rex
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Pushing csv

2007-11-08 Thread Symeon Breen
To make the browser treat it as a download is a combination of the mime type 
set for the file extension on the web server and what the end users browser is 
set to do with that mime type.  You may find that by default .csv is set to 
text/plain so you may want to configure your web server to something different.

 
Rgds
Symeon


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Barouch
Sent: 08 November 2007 17:14
To: u2-users@listserver.u2ug.org
Subject: [U2] Pushing csv

All,
  I am building CSV data and HTML data out of a database and pushing the 
results back to the browser which made the request.
  I have no problem building the data or pushing the HTML. The CSV data, 
however is tricky because it is in memory, not a file, and I need to 
know how to send it to the browser *in a way that the browser will treat 
it as a download*.
  I'm pretty sure there is some HTML I can slot into the  
to do this task, but I can't find a good example.
  All help appreciated.

- Chuck
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/