Multiplying INT and USUAL
Posted: Wed Apr 21, 2021 6:15 pm
Forgive me if this was brought up before. I did some search on this forum and could not find any mention of it. We are testing our conversion application from VO to X#. I ran into an interesting issue. Here is our line of code:
iNoMode and m are both INT type. iPmtType is a parameter. PAYMENT_REVERSAL is a define.
m=1
iPmtType=3
PAYMENT_REVERSAL=3
In VO iNoMode result is -1, but in X# it is 255. If I cast the factors as such:
Then the result is what we expected, which is -1. I am able to re-create this issue using console application.
I know it would be better if we strong type our variables. Is there is a plan to address this situation?
Thanks,
Boonnam
Code: Select all
iNoMode := IIF(m=4,2,1) * IIF( iPmtType = PAYMENT_REVERSAL, -1, 1 )
m=1
iPmtType=3
PAYMENT_REVERSAL=3
In VO iNoMode result is -1, but in X# it is 255. If I cast the factors as such:
Code: Select all
iNoMode := (INT)IIF(m=4,2,1) * (INT)IIF( iPmtType = PAYMENT_REVERSAL, -1, 1 )
Code: Select all
FUNCTION Start() AS VOID STRICT
local iMode, iCount as int
local iPmtType, iReversal as usual
iPmtType := 3
iReversal := 3
iCount := 1
iMode := iif(iCount==4,2,1) * iif(iPmtType == iReversal,-1,1)
? "iMode " + iMode:ToString()
wait
RETURN
I know it would be better if we strong type our variables. Is there is a plan to address this situation?
Thanks,
Boonnam