PS: I tested with the 7.6.4 version and I become the same wrong result...This message has been edited. Last edited by: Jérény Deidda,
WebFOCUS 7.6.4 running on Windows Output formats : PDF, Excel and HTML My blog
January 15, 2008, 08:07 AM
<ludo>
Hello everybody,
Just try to put a \ character before the +
Dr Nick
January 15, 2008, 08:50 AM
hammo1j
DM variables are all stored as strings and their type is determined at runtime by parsing the data according to the operator.
Thus depending on the operator concerned ' 1234.56 ' can be a string or a double precision number
Example: the equality operator attempts to convert both sides to numbers where possible so
' 1234.56 ' EQ '1234.56' will be true.
This is the behaviour in your case. WebFOCUS assumes '+' and '-' are numbers (incorrectly) and converts both to zero.
To ensure an alphanumeric operand in any test concatenate a blank
eg instead of -IF &A EQ &B THEN ...
do
-IF &A | ' ' EQ &B | ' ' THEN ...
Painful I know. In retrospect dm variables may have been better with types but that would make them less flexible but less confusing!
Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2 Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
January 15, 2008, 08:56 AM
GamP
There is an easier and more robust way to do this kind of equations in DM. Use the ASIS functions like: -IF ASIS('-') EQ ASIS('+') THEN GOTO :ADDFEES;
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
January 15, 2008, 09:17 AM
Jérény Deidda
Thx for all these explanations.
WebFOCUS 7.6.4 running on Windows Output formats : PDF, Excel and HTML My blog
January 15, 2008, 09:29 AM
hammo1j
GamP
You're right ASIS would be the correct way to do this but it does not work in subroutine arguments when you want to force an alpha, that's why I stick to blank concat cos it always works.
Regards
John
Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2 Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
January 15, 2008, 10:31 AM
Jérény Deidda
Another bug:
-SET &TEST = 0-0.1;
-TYPE &TEST
I become 0 instead of -0.1. Why?
WebFOCUS 7.6.4 running on Windows Output formats : PDF, Excel and HTML My blog
January 15, 2008, 11:01 AM
LEX-IA
Integer minus decimal is integer...
PROD: WebFOCUS 7.1.0 on Linux/Tomcat 5.5.12 (standalone)/Informix on AIX TEST: WebFOCUS 7.1.3 on Linux/Tomcat 5.5.16 (standalone)/Informix on AIX
January 15, 2008, 11:06 AM
Jérény Deidda
I tried 0.1 - 0.2 and the result is the same.
WebFOCUS 7.6.4 running on Windows Output formats : PDF, Excel and HTML My blog
January 15, 2008, 11:35 AM
hammo1j
Problem is resolved by a setting in 7.6. Prior releases have rounding of results to integer. If you need to retain the precision multiply by a power of 10.
Try 100 * (0.32 - 0.13) should be 19.
Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2 Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
January 16, 2008, 03:44 AM
Jérény Deidda
The problem is that I don't know the precision before making the subtraction. Another idea?
Furthermore, I tried this:
-SET &TEST = 19/100;
-TYPE &TEST
-QUIT
The result is always WRONG : 0 instead of 0.19This message has been edited. Last edited by: Jérény Deidda,
WebFOCUS 7.6.4 running on Windows Output formats : PDF, Excel and HTML My blog
January 16, 2008, 04:46 AM
Tony A
Jérény,
Amper variables have always been dealt with as alphanumeric or integer. So what you are experiencing is not a bug.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
until you get 7.6 and use the DMPRECISION setting. As Tony says, not a bug, but expected behavior.
Alan. WF 7.705/8.007
January 16, 2008, 05:47 AM
Jérény Deidda
OK thanks for this solution.
I called IBI support and an employee told me that the best way is to avoid making operations with th SET command and to make that in a DEFINE FILE or in a TABLE FILE when it's possible.
WebFOCUS 7.6.4 running on Windows Output formats : PDF, Excel and HTML My blog