Focal Point
[SOLVED] Displaying Null Values in Numerics

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

March 14, 2013, 04:23 PM
OWinters
[SOLVED] Displaying Null Values in Numerics
I am screening an alphanumeric feed from another environment and building a Master file for use in WebFocus. Currently, for a particular set of fields, after a GETTOK, ATODBL is turning Null values into zeros. These Null values are valid and need to be preserved as they require representaion in the environment. Is there anyway to represent Nulls along with zeros?

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


WebFOCUS 7.6.1.0
Excel, PDF, HTML
March 14, 2013, 04:31 PM
eric.woerle
What about accounting for the null in your define?
NEW_NUMBER/I8 MISSING ON = IF ORIG_FIELD IS MISSING THEN MISSING ELSE ATODBL(ORIG_FIELD) ;



Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
March 14, 2013, 04:56 PM
Waz
How are the nulls stored ?


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!

March 15, 2013, 08:07 AM
OWinters
Thanks for repsonding. I had tried that, however, FOCUS is still implanting zeroS. (And in addition, it is placing a zero in the other values)

EW_NUMBER/I8 MISSING ON = IF ALPHA_FEED IS MISSING THEN MISSING ELSE ATODBL(ALPHA_FEED, '15', NEW_NUMBER);


ALPHA_FEED NEW_NUMBER
0
0
0.0709219858156 0
0 0
0 0


WebFOCUS 7.6.1.0
Excel, PDF, HTML
March 15, 2013, 08:17 AM
OWinters
Thank you for responding.

A huge alphanumeric string of data is the feed for creation of the Master. The data: zeros, values greater than zero, and Nulls, are in the string and GETTOK retrieves. So a blank at the designated spot in the string denotes a null value for that particular instance of the field to be built.

The issue is that I do not see a way to preserve the Null value since fucntions will interpet a blank into a zero when creating a numeric field format.

My current workaround is to create a display version of the field in alphanumeric and a numeric version for calculations. I would set the Nulls for the numeric version to a value the users deem never to occur otherwise and code around that in production.


WebFOCUS 7.6.1.0
Excel, PDF, HTML
March 15, 2013, 12:09 PM
eric.woerle
OWinters,

You shouldn't have to create 2 different fields. It seems to me that this is just a situation of identifying what value constitutes your null value. Instead of Checking for a null value, since you are reading from a text file, you may need to check for a space or blank and then assign to null. Also you might need to set your SET NODATA to a value other then 0.

SET NODATA = .  


Something like that.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
March 15, 2013, 01:09 PM
OWinters
Yes that is what I am checking for; a blank, then I want to assign to null. Will numeric formats hold a .? I tried the Set NODATA = . but it seems any conversion of alpha to numeric flips a null or . or space to zero.


WebFOCUS 7.6.1.0
Excel, PDF, HTML
March 15, 2013, 02:54 PM
Mighty Max
Numeric fields will hold Null/Missing values but you need to declare them with MISSING ON.
Back to what Eric was saying. If the result of your GETTOK is blank then assign it to MISSING else the value of the GETTOK.
  
TABLE FILE CAR
PRINT
   COMPUTE INPUT_STRING/A50 = '0.785445,,45.444,0.000,5.654,4585.58';
   COMPUTE FLD_1/A50 MISSING ON = IF GETTOK(INPUT_STRING, 50, 1, ',', 50, FLD_1) EQ ' ' THEN MISSING ELSE GETTOK(INPUT_STRING, 50, 1, ',', 50, FLD_1);
   COMPUTE FLD_2/A50 MISSING ON = IF GETTOK(INPUT_STRING, 50, 2, ',', 50, FLD_2) EQ ' ' THEN MISSING ELSE GETTOK(INPUT_STRING, 50, 2, ',', 50, FLD_2);
   COMPUTE FLD_3/A50 MISSING ON = IF GETTOK(INPUT_STRING, 50, 3, ',', 50, FLD_3) EQ ' ' THEN MISSING ELSE GETTOK(INPUT_STRING, 50, 3, ',', 50, FLD_3);
   COMPUTE FLD_4/A50 MISSING ON = IF GETTOK(INPUT_STRING, 50, 4, ',', 50, FLD_4) EQ ' ' THEN MISSING ELSE GETTOK(INPUT_STRING, 50, 4, ',', 50, FLD_4);
   COMPUTE FLD_5/A50 MISSING ON = IF GETTOK(INPUT_STRING, 50, 5, ',', 50, FLD_5) EQ ' ' THEN MISSING ELSE GETTOK(INPUT_STRING, 50, 5, ',', 50, FLD_5);
   COMPUTE FLD_6/A50 MISSING ON = IF GETTOK(INPUT_STRING, 50, 6, ',', 50, FLD_6) EQ ' ' THEN MISSING ELSE GETTOK(INPUT_STRING, 50, 6, ',', 50, FLD_6);
   COMPUTE DBL_1/D20.12 MISSING ON = ATODBL(FLD_1, '15', DBL_1);
   COMPUTE DBL_2/D20.12 MISSING ON = ATODBL(FLD_2, '15', DBL_2);
   COMPUTE DBL_3/D20.12 MISSING ON = ATODBL(FLD_3, '15', DBL_3);
   COMPUTE DBL_4/D20.12 MISSING ON = ATODBL(FLD_4, '15', DBL_4);
   COMPUTE DBL_5/D20.12 MISSING ON = ATODBL(FLD_5, '15', DBL_5);
   COMPUTE DBL_6/D20.12 MISSING ON = ATODBL(FLD_5, '15', DBL_6);

BY COUNTRY
BY CAR
ON TABLE SET NODATA 'No Data'
ON TABLE SET CENT-ZERO ON
END
-RUN



WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
March 15, 2013, 03:31 PM
eric.woerle
Thanks Max,

That is exactly what I was saying. Much better put by you. Also the SET NODATA is a max. It doesn't actually change the table but rather tells WebFOCUS how to display a null value on the screen when it comes across it.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
March 15, 2013, 04:42 PM
OWinters
OK. I am giving this a whirl and will let you know how it went. Thank you both for the input and enjoy the weekend.

Regards.


WebFOCUS 7.6.1.0
Excel, PDF, HTML
March 18, 2013, 10:17 AM
OWinters
Worked like a charm.

So in the resulting Master File, with the use of MISSING=ON, the Null value of the field will display as '.', (as it was designated in my test) within the environment, unless otherwise set.

(Such as SET NODATA = NULL or SET NODATA = BLANK)

Correct?

In other words, there will be no need to stipulate how the Null field displays after the build of the Master as long as End-Users are fine with '.'.