Focal Point
[SOLVED] Math not working for decimals.

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

July 29, 2015, 04:02 PM
GavinL
[SOLVED] Math not working for decimals.
I've done quit a bit of searching, but I'm unable to find any help on doing math with float/decimal as when I try it, it fails.. I'm just trying to get the percentage of the two, so I need it to be a float/decimal. What am I missing?

-DEFAULTH &NOTCOMPLIANT=3.0;
-TYPE NOTCOMPLIANT = &NOTCOMPLIANT;

-DEFAULTH &COMPLIANTTOTAL=126.0;
-TYPE COMPLIANTTOTAL = &COMPLIANTTOTAL;

-DEFAULTH &PERC = 0.0;
-* The following doesn't seem to work.
-SET &PERC=(&NOTCOMPLIANT / &COMPLIANTTOTAL);
-* The following shows 0.
-TYPE PERC = &PERC;

-DEFAULTH &TOTPERC = 0.0;
-SET &TOTPERC=(1-&PERC);
-TYPE TOTPERC = &TOTPERC;

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



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
July 29, 2015, 04:12 PM
Francis Mariani
Gavin, Dialogue Manager works with strings. Sometimes the strings can be numbers, but by default they're considered integers.

Use
SET DMPRECISION = {OFF|n}
to set a number precision in Dialogue Manager.


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
July 29, 2015, 04:16 PM
GavinL
Perfect!

SET DMPRECISION = 2
-RUN

-DEFAULTH &NOTCOMPLIANT=3.0;
-TYPE NOTCOMPLIANT = &NOTCOMPLIANT;

-DEFAULTH &COMPLIANTTOTAL=126.0;
-TYPE COMPLIANTTOTAL = &COMPLIANTTOTAL;

-DEFAULTH &PERC = 0.0;
-SET &PERC=(&NOTCOMPLIANT / &COMPLIANTTOTAL);
-TYPE PERC = &PERC;

-DEFAULTH &TOTPERC = 0.0;
-SET &TOTPERC=(1-&PERC);
-TYPE TOTPERC = &TOTPERC;
-EXIT




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
July 30, 2015, 08:42 AM
Tomsweb
FOCUS manipulators? Nice touch.


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36