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. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Compute "Delta" Placement and Format Issue

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Compute "Delta" Placement and Format Issue
 Login/Join
 
Silver Member
posted
Hello all.

I need to calculate the delta between two dynamic values that are really in the same column - year over year.

I developed a work around using an ACROSS - and then placed the COMPUTE after the ACROSS - which gave me the value I wanted in the place I wanted. Try it without the across, and you get a mess.

Trouble is, I cannot style the new DELTA column or add conditional styling - something I need for negative numbers. Nothing I do is recognized (except SQUEEZE width, which is respected).

Here is the code and an example of the output. I would be happy to get rid of the ACROSS if there is some way to calculdate the delta via something like C3(R2-R1) which I tried to no avail.





-DEFAULT &DBS1 = 'SURG'
-DEFAULT &Year = '2010'
-DEFAULT &Month = '09'

-SET &PRYEAR= &Year -1 ;
-SET &PRYEAR2= &Year -2 ;
-SET &PRYEAR3= &Year -3 ;

-INCLUDE inc_varsre.fex

TABLE FILE NDAY_GEAC_SUMMARY
SUM
     TOTAL_GRANT_AMT/D12CM AS ''
BY  &SORTVAR AS 'Grant Spending (YTD)'
ACROSS YEAR AS ''
     COMPUTE
          TOTAL_GRANT_AMT/D12C = ( C3 - C2 ); AS 'Delta'
WHERE YEAR EQ '&Year' OR '&PRYEAR';
WHERE EDIT(YEARMO,'$$$$99')  LE '&Month';
WHERE &WHEREVAR EQ '&MEDDIV';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     LEFTMARGIN=0.000000,
     RIGHTMARGIN=0.000000,
     TOPMARGIN=0.000000,
     BOTTOMMARGIN=0.000000,
     SQUEEZE=ON,
     PAGECOLOR='WHITE',
$
TYPE=REPORT,
     BORDER-TOP=LIGHT,
     BORDER-BOTTOM=LIGHT,
     BORDER-LEFT=LIGHT,
     BORDER-RIGHT=LIGHT,
     BORDER-TOP-COLOR=RGB(18 72 124),
     BORDER-BOTTOM-COLOR=RGB(18 72 124),
     BORDER-LEFT-COLOR=RGB(18 72 124),
     BORDER-RIGHT-COLOR=RGB(18 72 124),
     FONT='VERDANA',
     SIZE=8,
     COLOR='BLACK',
     STYLE=NORMAL,
     JUSTIFY=CENTER,
$
TYPE=DATA,
     COLUMN=N1,
     FONT='CALIBRI',
     JUSTIFY=LEFT,
$
TYPE=TITLE,
     BORDER-TOP=LIGHT,
     BORDER-BOTTOM=LIGHT,
     BORDER-LEFT=LIGHT,
     BORDER-RIGHT=LIGHT,
     BORDER-TOP-COLOR=RGB(18 72 124),
     BORDER-BOTTOM-COLOR=RGB(18 72 124),
     BORDER-LEFT-COLOR=RGB(18 72 124),
     BORDER-RIGHT-COLOR=RGB(18 72 124),
     FONT='ARIAL',
     SIZE=8,
     COLOR='WHITE',
     BACKCOLOR=RGB(18 72 124),
     STYLE=BOLD,
$
TYPE=TITLE,
     COLUMN=N1,
     JUSTIFY=LEFT,
$
TYPE=ACROSSVALUE,
     ACROSS=1,
     BORDER-TOP=OFF,
     BORDER-BOTTOM=LIGHT,
     BORDER-LEFT=OFF,
     BORDER-RIGHT=OFF,
     FONT='ARIAL',
     SIZE=7,
     COLOR=RGB(18 72 124),
     STYLE=BOLD,
$
TYPE=ACROSSTITLE,
     ACROSS=1,
     FONT='ARIAL',
     SIZE=7,
     COLOR=RGB(18 72 124),
     STYLE=BOLD,
$
TYPE=REPORT,
     COLUMN=N1,
     SQUEEZE=1.791667,
$
TYPE=REPORT,
     COLUMN=N4,
     SQUEEZE=0.791667,
$
TYPE=REPORT,
     COLUMN=N3,
     SQUEEZE=0.791667,
$
TYPE=REPORT,
     COLUMN=N2,
     SQUEEZE=0.791667,
$
ENDSTYLE
END


And BTW, this is one of many fex that are placed on a DOC COMPOSER page for final output.

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


Damon
WF 7.7.02M LINUX
PMF 5.3.1
HTML, PDF, EXCEL
 
Posts: 39 | Registered: February 23, 2011Report This Post
Virtuoso
posted Hide Post
you can put it first in a hold file, or define the two years values in separate fields




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Silver Member
posted Hide Post
There are already so many variables involved, a define would be tricky in this case...

Really - a HOLD file? There is really no straight-forward way to call a specific (Column.Row - Column.Row) function of some sort?


Damon
WF 7.7.02M LINUX
PMF 5.3.1
HTML, PDF, EXCEL
 
Posts: 39 | Registered: February 23, 2011Report This Post
Expert
posted Hide Post
What about something like this:

-SET &THIS_YEAR = EDIT(&YYMD,'9999');
-SET &LAST_YEAR = &THIS_YEAR - 1;

...

TABLE FILE NDAY_GEAC_SUMMARY
SUM
COMPUTE TOTAL_GRANT_AMT_LY/D12CM = IF YEAR EQ &LAST_YEAR THEN TOTAL_GRANT_AMT ELSE 0; AS 'Grant &LAST_YEAR'
COMPUTE TOTAL_GRANT_AMT_TY/D12CM = IF YEAR EQ &THIS_YEAR THEN TOTAL_GRANT_AMT ELSE 0; AS 'Grant &THIS_YEAR'

COMPUTE TOTAL_GRANT_AMT_DL/D12C = ( TOTAL_GRANT_AMT_TY - TOTAL_GRANT_AMT_LY ); AS 'Delta'

BY  &SORTVAR AS 'Grant Spending (YTD)'
...


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
Silver Member
posted Hide Post
Thank you Francis. I get it.

Very helpful, as always!


Damon
WF 7.7.02M LINUX
PMF 5.3.1
HTML, PDF, EXCEL
 
Posts: 39 | Registered: February 23, 2011Report 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] Compute "Delta" Placement and Format Issue

Copyright © 1996-2020 Information Builders