When I run the code below with the Default Make of "BMW' I get prompted to Open, Save or Save as the CSV output(6 records) in Excel. If I enter a Make of 'KIA', no records are found and I branch to label 'RUN_RPT2' where I run the same code with Make 'BMW' but I don't get prompted to open the CSV output in Excel. Has anyone experienced this issue or have a solution ?
-SET &ECHO = 'ALL'; -DEFAULT &MAKE = 'BMW' -* TABLE FILE CAR WHERE CAR EQ '&MAKE'; SUM RCOST DCOST BY CAR BY MODEL ON TABLE PCHOLD FORMAT COM END -RUN -IF &LINES EQ 0 GOTO RUN_RPT2; -EXIT -* -RUN_RPT2 TABLE FILE CAR WHERE CAR EQ 'BMW'; SUM RCOST DCOST BY CAR BY MODEL ON TABLE PCHOLD FORMAT COM ENDThis message has been edited. Last edited by: FP Mod Chuck,
Dev Studio 8.0.09 App Studio 8.2.01 DB2, FOCUS PDF, HTML, Excel, CSV In Focus since 1983
July 25, 2018, 04:24 PM
BabakNYC
It reproduces in 8203M as well. I added a -RUN and it didn't make a difference. I also tried different formats like XLSX and PDF. The only two formats that worked are HTML and AHTML. I really can't figure out what's causing this but clearly it has to do with the &LINES if test.
WebFOCUS 8206, Unix, Windows
July 25, 2018, 04:34 PM
jfr99
Try using HOLD files ... then create the CSV at the end ... Like this ...
SET EXCELSERVURL = ''
-*
-DEFAULT &MAKE = 'KIA'
-*
TABLE FILE CAR
WHERE CAR EQ '&MAKE';
SUM
RETAIL_COST
DEALER_COST
BY CAR
BY MODEL
ON TABLE HOLD
END
? HOLD
-RUN
-IF &LINES EQ 0 GOTO RUN_RPT2;
-GOTO DO_CSV;
-EXIT
-*
-RUN_RPT2
TABLE FILE CAR
WHERE CAR EQ 'BMW';
SUM
RETAIL_COST
DEALER_COST
BY CAR
BY MODEL
ON TABLE HOLD
END
? HOLD
-RUN
-*
-DO_CSV
TABLE FILE HOLD
SUM
RETAIL_COST
DEALER_COST
BY CAR
BY MODEL
ON TABLE PCHOLD FORMAT XLSX
END
WebFocus 8.201M, Windows, App Studio
July 26, 2018, 11:29 AM
TedB
jfr99,
Thank you for your reply. Your work around using a hold file works fine. I don't know why the original code doesn't work with 'COM' or 'COMT' formats. It works with Excel, PDF, HTML, DHTML, WP, etc.
Ted
Dev Studio 8.0.09 App Studio 8.2.01 DB2, FOCUS PDF, HTML, Excel, CSV In Focus since 1983