Focal Point
Format COM/COMT
April 26, 2007, 06:59 PM
j.grossFormat COM/COMT
In a self-service app, a report with PCHOLD FORMAT COM (or COMT) results in a Windows SAVE dialog. Trouble is (a) the HOLD name is not respected; (b) there is no default filetype (I expect .csv); (c) I'd really rather avoid the Save dialog entirely and have the spreadsheet open in the browser (or Excel depending on settings), just like FORMAT EXCEL does.
Any ideas?
[WF 7.1.4, Win 2003 server]
August 22, 2007, 10:29 AM
TedBWere you ever able to resolve this issue? I also would like "PCHOLD FORMAT COMT" to behave like 'PCHOLD FORMAT EXCEL". I don't understand why file extension ".csv" is not used with format COMT.
Thanks,
Ted
Dev Studio 8.0.09
App Studio 8.2.01
DB2, FOCUS
PDF, HTML, Excel, CSV
In Focus since 1983
August 22, 2007, 12:07 PM
Tony ATed,
How about FILEDEFing the output file to somewhere on the server, accessable by the client, and then entering into an HTMLFORM where you have an onload script that changes the page location to the file?
Something like -
-HTMLFORM BEGIN
<html>
<head>
<title>Page Title</title>
<script language=javascript>
function fetch_src() {
this.location.href = "file://servername/folder/filename.csv";
}
</script>
</head>
<body bgcolor="#fcfbff" OnLoad="fetch_src();">
</body>
</html>
T
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | | |
WebFOCUS App Studio 8.2.06 standalone on Windows 10 | |
August 22, 2007, 03:42 PM
TedBTony,
Thanks for your reply.
I'm testing this on my local box(localhost). If my Filedef is "FILEDEF SAVCSV DISK C:\ibi\apps\session\savcsv.csv", what would I put for "file://servername/folder/filename.csv"?
Dev Studio 8.0.09
App Studio 8.2.01
DB2, FOCUS
PDF, HTML, Excel, CSV
In Focus since 1983
August 23, 2007, 06:32 AM
Tony ATed,
Apologies, the "folder" should have been "network share".
For instance, I use this method to load a file created using a reiterative process that adds many an output to a new sheet in a web archive (Excel templates). However, I need to HOLD the final output as an .xls file and not a PCHOLD file, which leaves it as an .xht (see below). This is so that the drilldowns will function and not screw up(esp. when using the back button!!), also so that the file doesn't have to be saved by the User.
In the following I have used ficticious naming.
There a network share called "Userdata" which just happens to be on the reporting server ("WFServer" - yep, imaginative!). I FILEDEF the file to this location -
FILEDEF Output&Cnt.EVAL DISK c:\Userinfo\Output&Cnt.EVAL.xls
where &Cnt is the iteration, as I never know how many sheets I'll need.
In the HTMLFORM I have the snippet of code -
<html>
<head>
<title>Output Report</title>
<script language=javascript>
function fetch_src() {
alert("Loading Report");
this.location.href = "file://WFServer/Userdata/Output!IBI.AMP.Cnt;.xls";
}
</script>
</head>
<body bgcolor="#fcfbff" OnLoad="fetch_src();">
</body>
</html>
-HTMLFORM END
Works like a dream, especially as the open subroutine in the VBA reformats all the worksheets (including page size, print area etc. etc.), adds cell calculations and then saves itself before removing the VBA code.
T
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | | |
WebFOCUS App Studio 8.2.06 standalone on Windows 10 | |
November 01, 2007, 11:52 AM
TedBHi Tony,
Thanks again for your help.
The following code works great on my PC:
FILEDEF SAVCSV DISK C:\ibi\apps\session\savcsv.csv
-RUN
-*
TABLE FILE CAR
PRINT
CAR
MODEL
DEALER_COST
RETAIL_COST
SALES
ON TABLE SAVE AS SAVCSV FORMAT COMT
END
-RUN
-*
-HTMLFORM BEGIN
Page Title<script language=javascript>
function fetch_src() {
this.location.href = "file://WD-OH1CCTA4Q510/session/savcsv.csv";
}
If I run the following (using Dev Studio in another environment(not localhost)):
TABLE FILE CAR
PRINT
COUNTRY
CAR
MODEL
DEALER_COST
RETAIL_COST
SALES
ON TABLE SET PAGE-NUM OFF
ON TABLE SAVE AS SAVCSV FORMAT COMT
END
? FILEDEF
I get this:
NUMBER OF RECORDS IN TABLE= 18 LINES= 18
Lname Device Lrecl Recfm Append Filename
SAVCSV DISK 105 V /opt/eda/ibi/srv71/wfs/edatemp/ts003840/savcsv.csv
Finally my question. Is there a way to get the JavaScript to point to this file(../edatemp/ts003840/savcsv.csv) and work the same as it does above when I "FILEDEFed" savcsv.csv to my local drive and ran on my PC(localhost)?
This whole issue could be avoided if WebFOCUS would just put an extension(.csv) on the file when you do an "ON TABLE PCHOLD FORMAT COMT"(as it does with "ON TABLE PCHOLD FORMAT EXL2K").
Thanks,
Ted
Dev Studio 8.0.09
App Studio 8.2.01
DB2, FOCUS
PDF, HTML, Excel, CSV
In Focus since 1983
November 01, 2007, 12:32 PM
Tony ATed,
I would not suggest you leave any temporary file in EDATEMP as it would require you to issue SET TEMPERASE = OFF, and as many a poster will testify, that is not a good idea.
Also, assuming you have TEMPERASE=ON (default) the file will no longer exist by the time your user gets the HTML redirect.
As for the PCHOLD issue, yes it would avoid the problem but then, as I mentioned above, it would require the User to remember to save the file if they required it as a permanent report, and we know how intelligent some Users can be
.
BTW - FORMAT EXL2K is not
exactly true Excel format. Again see many posts explaining this!
Glad you managed to get it to work.
T
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | | |
WebFOCUS App Studio 8.2.06 standalone on Windows 10 | |