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     [CLOSED] First line of ON TABLE PCHOLD FORMAT ALPHA missing

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] First line of ON TABLE PCHOLD FORMAT ALPHA missing
 Login/Join
 
Virtuoso
posted
Hello all,

I'm scratching my head over this one. I have some FOCUS code that's generating parts of a Javascript data-structure and the first line of results from the TABLE FILE goes missing. I'm using ON TABLE PCHOLD FORMAT ALPHA to get the TABLE FILE output directly in my code.

However, if I write it to an ALPHA file first and then -INCLUDE that, the first line is there!

Can anyone explain what is going on here?!?

My code is thus:
-HTMLFORM BEGIN
<html>
<body>
<pre>
var masters = {
-HTMLFORM END


-* Collect hold file info
APP QUERY ibisamp HOLD
DEFINE FILE FOCAPPQ
	UPDATED/A22		= EDIT(DATE, '99-$99-$9999') | ' / ' | EDIT(TIME, '99:$99');
	LEN/I2			= ARGLEN(70, FILENAME, LEN);
	UPFILNAM/A70	= UPCASE(70, FILENAME, UPFILNAM);
	STEM0/A70		= TRIM('T', UPFILNAM, LEN, '.MAS', 4, 'A70');
	STEM1/A70		= TRIM('T', UPFILNAM, LEN, '.FOC', 4, 'A70');
END
MATCH
 FILE FOCAPPQ
  PRINT
	UPDATED AS 'MASTER_DATE'
	UPFILNAM AS 'MASTER'

  BY STEM0 AS 'STEM'

  WHERE UPFILNAM LIKE '%.MAS';
 RUN
 FILE FOCAPPQ
  PRINT
	UPDATED AS 'FOC_DATE'
	UPFILNAM AS 'FOCFIL'

  BY STEM1 AS 'STEM'

  WHERE UPFILNAM LIKE '%.FOC';
 AFTER MATCH HOLD OLD-OR-NEW
END
-RUN

DEFINE FILE HOLD
	LINE/A511 = STEM || ': { file: "' || MASTER || '", created: "' || MASTER_DATE ||
				'", focfile: { file: "' || FOCFIL || '", created: "' || FOC_DATE ||
				'" }},';
END
TABLE FILE HOLD
PRINT
	LINE
BY HIGHEST MASTER_DATE NOPRINT
BY STEM NOPRINT
-*ON TABLE HOLD AS TMP_MASTERS FORMAT ALPHA
ON TABLE PCHOLD FORMAT ALPHA
END
-RUN


-HTMLFORM BEGIN
-*-INCLUDE TMP_MASTERS
};


-HTMLFORM END


Note that the CAR.MAS master file isn't listed.

It works if I change the bottom section to:
...
BY STEM NOPRINT
ON TABLE HOLD AS TMP_MASTERS FORMAT ALPHA
-*ON TABLE PCHOLD FORMAT ALPHA
END
-RUN

-HTMLFORM BEGIN
-INCLUDE TMP_MASTERS
};
...


But I'd rather not have the extra hold file...

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


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Expert
posted Hide Post
I guess it is something to do with what happens with format ALPHA.

With a FORMAT ALPHA, a master file is also returned describing the file.

Perhaps this is corrupting the first line.

I would suggest using your workaround.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
I thought I'd try with some other formats as well, and found that this doesn't just happen with FORMAT ALPHA, but with FORMAT TAB as well.

I suppose some people would call this a bug - I call it a dung beetle.

Time to tell IBI to fix this, I suppose.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Gold member
posted Hide Post
quote:
With a FORMAT ALPHA, a master file is also returned describing the file.


Any solution for this yet???


WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 58 | Registered: November 19, 2014Report This Post
Virtuoso
posted Hide Post
I seem to recall that the fix is to not switch between content types all the time.

The proper way to do this is to create the ALPHA files first and only then "include" them in the -HTMLFORM using !IBI.FIL.TMP_MASTERS;

That's actually cleaner to read too, and you can check whether you have any results before you enter HTML-space.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Gold member
posted Hide Post
Below is my code to create bar chart. It is skipping first line. The work around I do is to add a dummy line at the beginning. Client is Ok with it but it irks my eyes. Can you please tweak my code.

Thanks in advance.

  -HTMLFORM BEGIN

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawChart);

	  function drawChart() {
	  		var data = google.visualization.arrayToDataTable([ ['Car', 'Dcost', 'Rcost', 'Sales'],

-HTMLFORM END

SET NODATA = 'null'
SET HOLDLIST = PRINTONLY

-* Generate Javascript data

DEFINE FILE CAR
	COM/A2 = ', ';
END
TABLE FILE CAR
SUM
	COMPUTE LINESTART/A80 = '[''' || CAR || ''''; AS ''

		COM AS ''
		DEALER_COST AS ''
		COM AS ''
		RETAIL_COST AS ''
		COM AS ''
		SALES AS ''

	COMPUTE LINEEND/A3 = '],'; AS ''
BY CAR NOPRINT
ON TABLE PCHOLD FORMAT ALPHA
END
-RUN

-HTMLFORM BEGIN

]);						
						var options = {
							          chart: {
							          title: 'Company Performance',
							          subtitle: 'Sales, Expenses, and Profit: 2014-2017',
							          			},
				          			  bars: 'horizontal'
						    		  };

        var chart = new google.charts.Bar(document.getElementById('barchart_material'));
		chart.draw(data, google.charts.Bar.convertOptions(options));
	}

</script>
<div id="barchart_material" style="width: 900px; height: 500px;"></div>
-HTMLFORM END

-EXIT 


WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 58 | Registered: November 19, 2014Report This Post
Virtuoso
posted Hide Post
SET NODATA = 'null'
SET HOLDLIST = PRINTONLY

-* Generate Javascript data

DEFINE FILE CAR
	COM/A2 = ', ';
END
TABLE FILE CAR
SUM
	COMPUTE LINESTART/A80 = '[''' || CAR || ''''; AS ''

		COM AS ''
		DEALER_COST AS ''
		COM AS ''
		RETAIL_COST AS ''
		COM AS ''
		SALES AS ''

	COMPUTE LINEEND/A3 = '],'; AS ''
BY CAR NOPRINT
ON TABLE HOLD AS JSDATA FORMAT ALPHA
END
-RUN

-HTMLFORM BEGIN

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawChart);

	  function drawChart() {
	  		var data = google.visualization.arrayToDataTable([ ['Car', 'Dcost', 'Rcost', 'Sales'],


!IBI.FIL.JSDATA;
]);						
						var options = {
							          chart: {
							          title: 'Company Performance',
							          subtitle: 'Sales, Expenses, and Profit: 2014-2017',
							          			},
				          			  bars: 'horizontal'
						    		  };

        var chart = new google.charts.Bar(document.getElementById('barchart_material'));
		chart.draw(data, google.charts.Bar.convertOptions(options));
	}

</script>
<div id="barchart_material" style="width: 900px; height: 500px;"></div>
-HTMLFORM END

-* EXIT is a bad idea if the code gets wrapped by other procedures (ie. an RCaster job), as it's a HARD exit.
-*-EXIT


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Gold member
posted Hide Post
Thanks Man Smiler
You are the BEST!


WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 58 | Registered: November 19, 2014Report 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     [CLOSED] First line of ON TABLE PCHOLD FORMAT ALPHA missing

Copyright © 1996-2020 Information Builders