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] COLUMN-TOTAL RECOMPUTE on a DB_LOOKUP column

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] COLUMN-TOTAL RECOMPUTE on a DB_LOOKUP column
 Login/Join
 
Guru
posted
Hello,

I need some help to calculate a column-total using RECOMPUTE on a column populated from a DB_LOOKUP.

I reproduced it using CAR.
On my real report I need use RECOMPUTE on column-total, but without RECOMPUTE the db_lookup column is ok. Weird.

Any suggestions?

Thanks



-SET &ECHO=ALL;

-**********
-* SETs
-**********
SET CDN = ON
SET NODATA = 0
SET ASNAMES = ON
SET EMPTYCELLS = OFF
SET CENT-ZERO = ON

-*************************
-* VARIABLES MANIPULATIONS
-*************************




SET HTMLARCHIVE=ON
COMPOUND LAYOUT PCHOLD FORMAT PDF AS TEST_DB_LOOKUP
UNITS=PTS, $
SECTION=section1, LAYOUT=ON, METADATA='5^5^5^5^4', MERGE=OFF, ORIENTATION=LANDSCAPE, PAGESIZE=LETTER, SHOW_GLOBALFILTER=OFF, $


PAGELAYOUT=1, NAME='PAGE1', text='PAGE1', TOC-LEVEL=1, TOPMARGIN=1, ORIENTATION=LANDSCAPE, $
-*OBJECT=IMAGE, NAME='LOGO', IMAGE=ford_logo.jpg, ALT='', POSITION=(250 150), DIMENSION=(* *),  $
COMPONENT='HEADER', TEXT='HEADER', POSITION=(* *), DIMENSION=(* *),  $

COMPONENT='REPORT1', TEXT='REPORT1', POSITION=(+1 50), DIMENSION=(* *), RELATIVE-TO=HEADER, $


-RUN
-* END COMPOND REPORT


SET COMPONENT=HEADER
TABLE FILE CAR
HEADING
"TESTING DB_LOOKUP + RECOMPUTE COMPOUND PDF REPORT"
"TEST"
"CONFIDENTIAL"
BY COUNTRY NOPRINT
IF READLIMIT EQ 1
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, IMAGE=ford_logo.jpg, SIZE=(0.6 0.25), POSITION=(0.1 0.1),  $
TYPE=HEADING, GRID=OFF, FONT="FORD CE BLACK",  $
TYPE=HEADING, LINE=1, SIZE=7, JUSTIFY=CENTER, $
TYPE=HEADING, LINE=2, SIZE=5, JUSTIFY=CENTER, $
TYPE=HEADING, LINE=3, SIZE=4, JUSTIFY=RIGHT, STYLE='BOLD+UNDERLINE', $

TYPE=HEADING, LINE=4, object=box, name='line1', position = (1.0 0.4), dimension = (9.0 0.002), backcolor=BLACK, border-color=BLACK,$

END


TABLE FILE CAR
SUM SALES AS 'TOTAL_SALES'
BY COUNTRY
ON TABLE HOLD AS HTOTALS
END


SET COMPONENT=REPORT1


TABLE FILE CAR
SUM SALES NOPRINT
SUM
SALES NOPRINT
COMPUTE TST/I9C=DB_LOOKUP(HTOTALS, COUNTRY, COUNTRY, TOTAL_SALES);
BY COUNTRY
SUM SALES/I9C
BY COUNTRY
ACROSS MODEL
COMPUTE TOTALX/I9C=C2; AS 'TOTAL'
COMPUTE PCT/D12.1 = (TOTALX/C1)*100;
ON TABLE COLUMN-TOTAL RECOMPUTE
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET STYLE *
TYPE=REPORT,
     FONT='ARIAL',
     SIZE=3,
	 WRAP=0.2,
     COLOR='BLACK',
     STYLE=NORMAL,
	  LEFTMARGIN=0.00,
	 ORIENTATION=LANDSCAPE,
	 BORDER-BOTTOM=LIGHT,
	 BORDER-LEFT=LIGHT,
	 BORDER-RIGHT=LIGHT,
	 BORDER-TOP=LIGHT,
$

TYPE=TITLE,
STYLE=BOLD,
$
TYPE=REPORT,
COLUMN=COUNTRY,
WRAP=0.9,
$
TYPE=GRANDTOTAL,
STYLE=BOLD,
BACKCOLOR='LIGHT GREY',
$

END

  

This message has been edited. Last edited by: Ricardo Augusto,


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
I suggest creating a HOLD file, then use MIN.TST:

SET ASNAMES=ON
SET HOLDLIST=PRINTONLY
-RUN

TABLE FILE CAR
SUM SALES AS 'TOTAL_SALES'
BY COUNTRY
ON TABLE HOLD AS HTOTALS
END
-RUN

TABLE FILE CAR
SUM
SALES
COMPUTE TST/I9C=DB_LOOKUP(HTOTALS, COUNTRY, COUNTRY, TOTAL_SALES);
BY COUNTRY
BY MODEL
ON TABLE HOLD AS HCAR1
END
-RUN

TABLE FILE HCAR1
SUM SALES NOPRINT
SUM
SALES NOPRINT
MIN.TST
BY COUNTRY
SUM SALES/I9C
BY COUNTRY
ACROSS MODEL
COMPUTE TOTALX/I9C=C2; AS 'TOTAL'
COMPUTE PCT/D12.1 = (TOTALX/C1)*100;
ON TABLE COLUMN-TOTAL RECOMPUTE
END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
If you just need a column total, can you use a define?



SET ASNAMES = ON

TABLE FILE CAR
SUM SALES AS 'TOTAL_SALES'
BY COUNTRY
ON TABLE HOLD AS HTOTALS
END

DEFINE FILE CAR
TST/I9C = DB_LOOKUP(HTOTALS, COUNTRY, COUNTRY, TOTAL_SALES);
END

TABLE FILE CAR
SUM SALES NOPRINT
SUM
SALES NOPRINT
TST
BY COUNTRY
SUM SALES/I9C
BY COUNTRY
ACROSS MODEL
COMPUTE TOTALX/I9C=C2; AS 'TOTAL'
COMPUTE PCT/D12.1 = (TOTALX/C1)*100;
ON TABLE COLUMN-TOTAL RECOMPUTE
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET STYLE *
TYPE=REPORT,
     FONT='ARIAL',
     SIZE=3,
	 WRAP=0.2,
     COLOR='BLACK',
     STYLE=NORMAL,
	  LEFTMARGIN=0.00,
	 ORIENTATION=LANDSCAPE,
	 BORDER-BOTTOM=LIGHT,
	 BORDER-LEFT=LIGHT,
	 BORDER-RIGHT=LIGHT,
	 BORDER-TOP=LIGHT,
$

TYPE=TITLE,
STYLE=BOLD,
$
TYPE=REPORT,
COLUMN=COUNTRY,
WRAP=0.9,
$
TYPE=GRANDTOTAL,
STYLE=BOLD,
BACKCOLOR='LIGHT GREY',
$

END

  


WebFOCUS App Studio 8.2.02
Windows 7, All Outputs
 
Posts: 141 | Location: Mclean, VA | Registered: December 04, 2012Report This Post
Guru
posted Hide Post
Thanks Both but the MIN operator is `forcing` a wrong calculations due to my data granularity.

I will try to reproduce my actual scenario.

This message has been edited. Last edited by: Ricardo Augusto,


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Report 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] COLUMN-TOTAL RECOMPUTE on a DB_LOOKUP column

Copyright © 1996-2020 Information Builders