Focal Point
[SOLVED] IF within a COMPUTE?

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

November 06, 2017, 12:00 PM
BSBAL18
[SOLVED] IF within a COMPUTE?
Can i properly place a IF within a compute stmt?

COMPUTE field1/D20.2 = (TOTAL_MISMATCHES / 308) * 100;

that "308" could be one of 3 values, depending on another column in the row. the above works, but only for 1 value (of course).

COMPUTE field1/D20.2 = (TOTAL_MISMATCHES / IF DIV = 'X' THEN 308 ELSE 444) * 100;

this give me an error on the "DIV" portion,

This message has been edited. Last edited by: FP Mod Chuck,


AS Version: 8201
Gen: 10202016
Windows, All Outputs
November 06, 2017, 12:06 PM
BabakNYC
IF DIV EQ 'X' THEN (TOTAL_MISMATCHES/308 )*100 ELSE (TOTAL_MISMATCHES/444)*100;

https://webfocusinfocenter.inf...rce/CommandRef46.htm

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


WebFOCUS 8206, Unix, Windows
November 06, 2017, 03:39 PM
Waz
BSBAL18, I think you may need some training.


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!

November 06, 2017, 03:49 PM
Todd_Wallace
Or you could do another compute first.

COMPUTE DIVISOR1/D3=IF DIV EQ 'X' THEN 308 ELSE 444;
COMPUTE field1/D20.2 = (TOTAL_MISMATCHES/DIVISOR1) * 100;



WebFOCUS 8.1.05
Windows-iSeries DB2, All Outputs
HTML