Page 1 of 1

pui.download Question

Posted: Wed Aug 20, 2014 10:01 am
by emhill
I am currently using the pui.download API along with the PUIDNLEXIT program to generate a PDF of a spool file for the user to display. It is working famously!

I have been getting requests to display the spool file in a text mode so the user can copy/paste into EXCEL. I'm using the following for the API:

===================
pui.download({"id": "CPYSPLF" + padprtfile + padjobname + padusername + padjobnbr + padspoolnbr, "inline": true, "contentType": "application/pdf"});
===================

Is there an "application/text" for "contentType" or something similar? Would there be a better alternative to doing what I need to do? The user wants to display the report on the screen, copy the data he wants, then paste that data to EXCEL. He is used to copying and pasting from the green screen spool file display but the green screen is going away for them.

Thanks in advance....

Re: pui.download Question

Posted: Wed Aug 20, 2014 10:05 am
by Scott Klement
Eric,

The content-type for a plain text file is 'text/plain'

In addition to changing the content-type parameter, you also need to change the code in PUIDNLEXIT to produce plain text instead of PDF.

Re: pui.download Question

Posted: Wed Aug 20, 2014 10:53 am
by emhill
Thanks Scott!

I found that from a list of MIME types (where I should have looked first!!!).

But herein lies another problem. When the user is on the green screen and displays a spool file he can copy and paste data to EXCEL and it will separate the columns correctly. I've been testing a little with some .txt files. Copying from Notepad and pasting to EXCEL copies everything to one column. I'm going to have to do some digging on this. Do you have any ideas? We do create .csv files for some reports but not others. For the others the user is just copying/pasting from the green screen.

Thanks!

Re: pui.download Question

Posted: Wed Aug 20, 2014 10:58 am
by Scott Klement
I've never done the copy/paste you reference. Maybe Client Access is doing something to make it easier?

You could consider loading your data into a subfile grid in PUI. Then turn on the "export CSV" option, this will make it easy to get the data in Excel.

Re: pui.download Question

Posted: Wed Aug 20, 2014 3:16 pm
by emhill
Scott,

Another quick question. What is the maximum number of characters that can be used for the "id" configuration option in the pui.download API?

Thanks!

Re: pui.download Question

Posted: Thu Aug 21, 2014 9:06 am
by Scott Klement
I think the 'id' can be up to 640 characters. I'm not sure that I ever tested it that long, though.

Re: pui.download Question

Posted: Thu Aug 21, 2014 10:33 am
by emhill
thanks Scott. Don't think I'll need anywhere near that much but just wanted to know what the limit was.

As always, I appreciate the help!