Focal Point
[SOLVED] WF NOT considering first part of IF loop

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

December 01, 2009, 02:44 PM
Wfdev
[SOLVED] WF NOT considering first part of IF loop
Hi,

The Issue i am experiencing when exporting data to excel is the IF loop in compute statement Not working as expected...

Please see the code...

DEFINE FILE HLD_NST
DUMMYAMT/I5='';
END
TABLE FILE HLD_NST
PRINT
'HLD_NST.HLD_NST.AREA_CODE' AS 'GL CODE'
'HLD_NST.HLD_NST.CURRENCY' AS 'CURRENCY'
'HLD_NST.HLD_NST.SHORT_CODE' AS 'NOSTRO'
'J1.HLD_LDG.CLOSING_BALANCE' AS 'CLOSING WSS BALANCE'
'J0.HLD_BB.AMT' AS 'CLOSING BANK BALANCE'
COMPUTE ABSDIFF/D20.2 MISSING ON NEEDS SOME DATA = IF (J0.HLD_BB.AMT EQ '') THEN DUMMYAMT ELSE IF (J1.HLD_LDG.CLOSING_BALANCE EQ '') THEN DUMMYAMT ELSE J0.HLD_BB.AMT - J1.HLD_LDG.CLOSING_BALANCE;
AS 'DIFFERENCE'
COMPUTE CONDDIFF/A20V = IF J0.HLD_BB.AMT EQ '' OR J1.HLD_LDG.CLOSING_BALANCE EQ '' THEN 'NR' ELSE '';
AS ' NOT REPORTED'
BY TOTAL HIGHEST COMPUTE DIFF/D20.2 = IF J0.HLD_BB.AMT EQ '' OR J1.HLD_LDG.CLOSING_BALANCE EQ '' THEN 0.0 ELSE IF ABS(J0.HLD_BB.AMT - J1.HLD_LDG.CLOSING_BALANCE) EQ 0 THEN 0.0001 ELSE ABS(J0.HLD_BB.AMT - J1.HLD_LDG.CLOSING_BALANCE + 1); NOPRINT

--------------------------
Here in ABSDIFF/D20.2 ideally i need to display '' when either if J0.HLD_BB.AMT EQ '' or J1.HLD_LDG.CLOSING_BALANCE EQ '' else calculate the difference...

I tried with
J0.HLD_BB.AMT EQ '' or J1.HLD_LDG.CLOSING_BALANCE EQ '' then DUMMYAMT else J0.HLD_BB.AMT - J1.HLD_LDG.CLOSING_BALANCE ...But that gives me .00 as the o/p if first condition..so i modified with the above code...

Then Now what happens is the second condition works fine(ELSE IF (J1.HLD_LDG.CLOSING_BALANCE EQ '') THEN DUMMYAMT works fine but not the first condition..so if the first if has '' it gives me o/p as .00...

if i interchage the data loop with first condition as J1.HLD_LDG.CLOSING_BALANCE EQ '' then it will have .00 and J0.HLD_BB.AMT EQ '' works fine...

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


WebFOCUS 76
Windows
all formats
December 01, 2009, 03:06 PM
GinnyJakes
Well, first of all, in your define you are equating a numeric field to alpha ticks. You should probably be setting it to zero or missing. Then in your computes, you are comparing a numeric field to ticks when it should probably be zero or MISSING. You should probably do some reading on MISSING with virtual fields.

Another way to test is to create separate computes for each of your conditions and turn it to a one if it passes and a zero if it does not. That will give you a better idea of where the problem is to allow you to fix the original compute so that it works the way you want it to.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
December 01, 2009, 03:15 PM
Wfdev
Thanks a lot Ginny...

With Missing and ALL it works perfect....


WebFOCUS 76
Windows
all formats