As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
The reports we create give the user the choice of PDF, EXL2K, CSV or HTML. EMPTYREPORT works well for PDF, EXL2K and HTML, however if you run in CSV you get an No HTML Output! page. I can get an message at the end of page that says there is no data but it still displays the number of records each table call produced (see sample below) 0 NUMBER OF RECORDS IN TABLE= 1 LINES 1 0 NUMBER OF RECORDS IN TABLE= 3 LINES 3 0 NUMBER OF RECORDS IN TABLE= 0 LINES 0 as well as a heading that says 'No HTML Output'.
Is there some way to do this. Below is a sample of the code I am running.
-SET &OUTFMT='COMT'; SET EMPTYREPORT=ON TABLE FILE CAR PRINT COUNTRY WHERE COUNTRY EQ 'NOTHING'; ON TABLE PCHOLD FORMAT &OUTFMT END -RUN
-IF &LINES EQ 0 GOTO EMPTYCSV; -EXIT -EMPTYCSV -HTMLFORM BEGIN
No data for this report.
-HTMLFORM ENDThis message has been edited. Last edited by: Laura1,
I had already seen Ginny's solution, however I was hoping not to have to another table call as we sometimes has several multi select variables that need to go in the where clause. But if this is the only way then I guess I will work with it.
Will clearing the page before displaying your message solve the problem?
.
.
-IF (&LINES EQ 0) AND (&OUTFMT EQ 'COMT') GOTO EMPTYCSV ;
-EXIT
-EMPTYCSV
-HTMLFORM BEGIN
<SCRIPT Language="JavaScript">
document.body.innerHTML=""
</SCRIPT>
No data for this report.
-HTMLFORM END
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
You could also just branch to a procedure that DOES run a valid report when &LINES EQ 0;
TABLE FILE CAR
PRINT COUNTRY NOPRINT
HEADING
"NO DATA FOR THIS REPORT"
WHERE READLIMIT EQ 1
ON TABLE SET ONLINE-FMT HTML
stylesheet stuff here....
END
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
The problem with my suggestion is that the first report needs to have some type of output. Either you HOLD is (which you don't want to do) or you display it in which case you get the No HTML Output error. And it would not clear the HTML page - it would just display the result of the first fex and then those of the second fex - which is what you are seeing.
Maybe you could try only creating a hold file if they choose COMT format. Or doing a sum the first time through (to only create a single line and shorten the HOLD process) check the &LINES for 0 records and then run the whole procedure again if &LINES NE 0. Just a couple of ideas--
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
You can hold the file first and check the number of records
Along with Darin's idea:
quote:
Maybe you could try only creating a hold file if they choose COMT format ... check the &LINES for 0 records and then run the whole procedure again if &LINES NE 0
Coupled with Tom's:
quote:
Do a hold with a recordlimit:
IF RECORDLIMIT EQ 10 -IF &LINES EQ 0 GOTO EMPTYCSV;
Should give you what you need without any significant penalty on performance, unless of course you're attempting to run a "huge" SQL aggregation query that takes a significant amount of time to be resolved even if the final answer set is "small" in which case you'd need to provide a special treatment for it.
All of their ideas combined should allow you to obtain the results you need.
0 NUMBER OF RECORDS IN TABLE= 1 LINES 1 0 NUMBER OF RECORDS IN TABLE= 3 LINES 3 0 NUMBER OF RECORDS IN TABLE= 0 LINES 0
Based on your sample output, it seems like you're attempting to retrieve records from different sources. If that assumption is correct, which result set is the one that is finally being "returned" as CSV?
Darin has hit the problem here, and that is that you are specifying PCHOLD which will return the results to your browser owing to the presence of the -RUN. The trouble is that you don't have any choice over the -RUN because you need to check the number of lines produced from your request.
What you need to do is to logically follow the flow through and identify where you need to intercept the processing to control the output to your users.
As Darin (and others) suggests, you need to HOLD the file when in COMT format so that you can identify when you have results to display. As you say, EMPTYREPORT is catering for the other types of output you need.
Also, as Nephtali implies and as you obviously have prior multiple TABLEs, you could identify when your output will contain no records at an earlier point in the process and redirect as necessary.
As a suggestion, try this and manipulate as required -
-SET &OUTFMT='COMT';
-SET &HOLDTYPE = IF &OUTFMT EQ 'COMT' THEN 'HOLD' ELSE 'PCHOLD';
SET EMPTYREPORT=ON
TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ 'NOTHING';
ON TABLE &HOLDTYPE FORMAT &OUTFMT
END
-RUN
-IF &LINES EQ 0 GOTO EMPTYCSV;
PCHOLD FORMAT &OUTFMT
-EXIT
-EMPTYCSV
-HTMLFORM BEGIN
No data for this report.
-HTMLFORM END
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
I know I didn't have the closing semi-colon and the closing script tag in on the thread here, but I did have them in on my actually code. Thanks for noticing just the same.
With regards to Tony's suggestion I am trying to create a standard piece of code that can be used in all our reports (approx. 50 reports). Using HOLD with 'COMT' means I would have to rerun the report if it has data. Some reports have as many as 15 to 20 goto labels in them which would make re-running the report alot more work as you would have to ensure that none of the labels are repeated and the dangers of causing a loop will be greatly increased. There doesn't seem to be an easy solution here.
Actually, if you look at Tony's code, he is not re-running it. The matrix still exists so you can output the result set again (if records exist) without having to re-run the entire code a second time.
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
Thank you, I did miss the line where Tony added the PCHOLD for when there was records. This seems to have solved the problem. Once again a big THANK YOU.