Focal Point
[CLOSED] Computed Field Issue

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8857045186

March 31, 2016, 11:09 AM
Sue Stan
[CLOSED] Computed Field Issue
Hi.
One of our users is having issues getting a virtual field to work correctly in InfoAssist. It seems to be correct on the surface, and our in-house IBI developer (15+ years experience) believes it should work, but it's not.

This is the "code":
IF ( InputYear LT 2013 ) THEN ( 0.052 * RevenueTotal ) ELSE
IF ( InputYear EQ 2013 ) THEN ( 0.051 * RevenueTotal ) ELSE
IF ( InputYear EQ 2014 ) THEN ( 0.051 * RevenueTotal ) ELSE
IF ( InputYear GT 2014 ) THEN ( 0.056 * RevenueTotal ) ELSE 0

To be clear, the fields used (InputYear and RevenueTotal are also virtual fields. The return is applying the 0.056 math to all years regardless of how we set up the statements...with and without the parens, etc.

These are the results... as you can see the math is wrong on the Administrative Expense for all years except 2015:

2009
Revenue Total
$18,706,352

Administrative Expense
$1,047,556


2010
Revenue Total
$22,570,546

Administrative Expense
$1,263,951


2011
Revenue Total
$26,278,346

Administrative Expense
$1,471,587


2012
Revenue Total
$32,619,378

Administrative Expense
$1,826,685


2013
Revenue Total
$34,495,318

Administrative Expense
$1,931,738


2014
Revenue Total
$39,521,818

Administrative Expense
$2,213,222


2015
Revenue Total
$44,029,503

Administrative Expense
$2,465,652
**************************************
Any help is greatly appreciated.

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


WebFOCUS 8.0, Windows
Excel, HTML, PDF
April 01, 2016, 09:33 AM
George Patton
I'm assuming that you DO have the semi-colon at the end of your define in the actual code?

How about:

IF InputYear EQ 2013 OR 2014 THEN 0.051 * RevenueTotal ELSE
IF  InputYear LT 2013  THEN  0.052 * RevenueTotal 
ELSE  0.056 * RevenueTotal;


I'm not a fan of unnecessary brackets, but they shouldn't make any difference here I don't think.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
April 05, 2016, 08:38 AM
BabakNYC
What's the format for InputYear? Try converting InputYear to an A4 and then create the compute using that.


WebFOCUS 8206, Unix, Windows
April 05, 2016, 09:04 AM
Dave
Sue,

are these COMPUTEs or DEFINEs?

If they are COMPUTEs the "InputYear" is multiplied by the number of lines in your dataset. Just like "SUM InputYear".

You might want to

IF ( FST.InputYear ...  ..) THEN .. ELSE


G'luck.


_____________________
WF: 8.0.0.9 > going 8.2.0.5