Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [solved] empty file when output is in CSV

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[solved] empty file when output is in CSV
 Login/Join
 
Silver Member
posted
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 END

This message has been edited. Last edited by: Laura1,


WebFOCUS 8105m
as well as 7.6.11
Windows 10
 
Posts: 33 | Registered: October 23, 2007Report This Post
Platinum Member
posted Hide Post
Hi,

You can hold the file first and check the number of records. And if there is at least one record then display it in the format of choice.

Best Regards,

Jimmy Pang


DEV: WF 7.6.10
TEST: WF 7.6.10
PROD: WF 7.6.10
MRE: WF 7.6.4
OS/Platform: Windows
Dev Studio: WF 7.7
Output: HTML, EXCEL, PDF, GRAPH, LOTUS, CSV
 
Posts: 117 | Location: Toronto, Ontario, Canada | Registered: February 29, 2008Report This Post
Silver Member
posted Hide Post
Sometimes my file has several thousand rows so I don't want to make the report any slower by doing a hold that is not required.


WebFOCUS 8105m
as well as 7.6.11
Windows 10
 
Posts: 33 | Registered: October 23, 2007Report This Post
Expert
posted Hide Post
Do a hold with a recordlimit:

IF RECORDLIMIT EQ 10

-IF &LINES EQ 0 GOTO EMPTYCSV;


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Gold member
posted Hide Post
Ginny has a nice solution in this post:

http://forums.informationbuild...71057331/m/594103902

Good luck!


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Report This Post
Silver Member
posted Hide Post
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.


WebFOCUS 8105m
as well as 7.6.11
Windows 10
 
Posts: 33 | Registered: October 23, 2007Report This Post
Virtuoso
posted Hide Post
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, 2007Report This Post
Virtuoso
posted Hide Post
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, 2007Report This Post
Silver Member
posted Hide Post
Thanks Dan, your suggestion works for me.

Thank you to everyone that responded


WebFOCUS 8105m
as well as 7.6.11
Windows 10
 
Posts: 33 | Registered: October 23, 2007Report This Post
Silver Member
posted Hide Post
The code below only works some of the time.

quote:
-HTMLFORM BEGIN
<script Language="JavaScript">
document.body.innerHTML=""


No data for this report.

-HTMLFORM END



Sometimes it produces an error
Internet Explorer Cannot Open the Internet Site... Operation Aborted

From the research I have done, the line document.body.innerHTML="" appears to be causing this issue.

Does anyone know a different way that I can clear the page before displaying the line
'No data for this report.'


WebFOCUS 8105m
as well as 7.6.11
Windows 10
 
Posts: 33 | Registered: October 23, 2007Report This Post
Silver Member
posted Hide Post
I have tried what Darin suggested, but it doesn't clear the page for some reason.


WebFOCUS 8105m
as well as 7.6.11
Windows 10
 
Posts: 33 | Registered: October 23, 2007Report This Post
Virtuoso
posted Hide Post
Please make sure you have the closing script tag. Also, put a semi-colon at the end of the innerHTML statement.

<SCRIPT Language="JavaScript">
document.body.innerHTML="";
</SCRIPT>


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Virtuoso
posted Hide Post
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, 2007Report This Post
Virtuoso
posted Hide Post
Jimmy's suggestion:
quote:
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.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
quote:
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?



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Expert
posted Hide Post
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, 2004Report This Post
Silver Member
posted Hide Post
quote:
Please make sure you have the closing script tag. Also, put a semi-colon at the end of the innerHTML statement.


<script Language="JavaScript">
document.body.innerHTML="";


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.


WebFOCUS 8105m
as well as 7.6.11
Windows 10
 
Posts: 33 | Registered: October 23, 2007Report This Post
Virtuoso
posted Hide Post
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, 2007Report This Post
Expert
posted Hide Post
quote:
means I would have to rerun the report if it has data

As Darin has pointed out, this is not a true statement, my suggestion just reuses the matrix.

You will not be able to use this method with TABLEF.

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, 2004Report This Post
Silver Member
posted Hide Post
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.


WebFOCUS 8105m
as well as 7.6.11
Windows 10
 
Posts: 33 | Registered: October 23, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [solved] empty file when output is in CSV

Copyright © 1996-2020 Information Builders