Focal Point
[SOLVED] DEFINE field not computing

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

October 26, 2017, 10:13 PM
BSBAL18
[SOLVED] DEFINE field not computing
I am doing a define as..

field1 + field2 + field3.

All fields are D20.2

if it is 1+1+1 it works, however sometimes tehre are nulls.. so 1+null+1. Technically a null answer is correct, however i need that to be 2 Smiler . HOw can i configure the field to ignore nulls?

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


AS Version: 8201
Gen: 10202016
Windows, All Outputs
October 26, 2017, 10:59 PM
Waz
MISSING values give me a pain in the DEFINE FILE.

You may have to check each field for MISSING and cater for it.


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!

October 27, 2017, 04:29 AM
Hank W.
Can you default a null with 0 in the previous hold?


Cheers,
H.

WebFOCUS 8.1.05M
Oracle 11g - DB2
RedHat
October 27, 2017, 07:22 AM
BabakNYC
How about using an IF THEN ELSE to substitute? Something like this:

FIELD_1A/I9=IF FIELD_1 EQ MISSING THEN 0 ELSE FIELD_1;
FIELD_2A/I9=IF FIELD_2 EQ MISSING THEN 0 ELSE FIELD_2;
FIELD_3A/I9=IF FIELD_3 EQ MISSING THEN 0 ELSE FIELD_3;

NEW_FIELD/I9=FIELD_1A + FIELD_2A + FIELD_3A;
  



WebFOCUS 8206, Unix, Windows
October 27, 2017, 07:42 AM
Mikel
Try the DEFINE with MISSING OFF.

FIELDT1/D20.2 MISSING OFF = FIELD1 + FIELD2 + FIELD3 ;

Working example CAR file:
DEFINE FILE CAR
  FIELD1/D20.2              = 1 ;
  FIELD2/D20.2 MISSING ON   = MISSING ;
  FIELD3/D20.2              = 1 ;
  FIELDT1/D20.2 MISSING OFF = FIELD1 + FIELD2 + FIELD3 ;
  FIELDT2/D20.2 MISSING ON  = FIELD1 + FIELD2 + FIELD3 ;
END

TABLE FILE CAR
  PRINT 
    COUNTRY
    FIELDT1 AS 'with MISSING OFF' ;
    FIELDT2 AS 'with MISSING ON' ;
  IF RECORDLIMIT EQ 1
END


Output:
COUNTRY  with MISSING OFFF  with MISSING ON
ENGLAND  2.0                .


Regards. Mikel.


WebFOCUS 8.1.05, 8.2.01
October 28, 2017, 11:07 PM
BSBAL18
{SOLVED} thanks!


AS Version: 8201
Gen: 10202016
Windows, All Outputs
October 29, 2017, 04:05 PM
Waz
Please edit your first post in this thread and add [SOLVED] to the title.


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!