Focal Point
[SOLVED] Code tightening problem wfs version 4 to wfs version 7

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

September 15, 2008, 05:48 AM
Jinx
[SOLVED] Code tightening problem wfs version 4 to wfs version 7
Hi,

I have an old report that I cannot migrate to out new version of webfocus. I think the reason is because of code tightening.
The old report has two SUMS (I am told this is called a multipath report). But this does not run in dev studio on our new version.

TABLE FILE HD1
SUM
 TOTNUM/D5  AS 'TOTAL,NO'
 TOTNET/D8  AS 'TOTAL,NET AMOUNT'
 CLEARNUM/D5  AS 'CLEARED,NO'
 COMPUTE PNO/D3=CLEARNUM*100/TOTNUM;  AS '%'
 CLEARNET/D8 AS 'CLEARED,NET AMT'
 COMPUTE PAMT/D3=CLEARNET*100/TOTNET; AS '%'
BY BOUNCE NOPRINT PAGE-BREAK
BY SECTOR SUBHEAD
"</1 ** TOTAL **"
WHEN SECTOR EQ 'ZZ'
SUM
 NO/D5   AS 'NO'
 AMT/D8  AS 'NET AMT'
BY BOUNCE NOPRINT
BY SECTOR
ACROSS REJECT AS REJECTIONS
END


I get an error in Dev studio because of the second SUM.

I have tried to get a similar result but with little success. Has anyone come up with a way around this in newer versions of wfs? I am unfortunately quite new to wfs so a little clueless ;-).

Thanks!

Jinx.

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


7.6.11
Windows
HTML, PDF, Excel etc
DevStudio/Webfocus/Focus IBM
SQL Server 2000 / 2008
DB2
September 15, 2008, 05:58 AM
<JG>
Jinx,

You get the error because of the WHEN not the second SUM.

Change it to WHERE and it will work.
September 15, 2008, 06:17 AM
Jinx
OH! I am such an idiot! It never even occurred to me that the WHEN was the problem, I had never seen SUM used twice so it looked all wrong - by removing the WHEN statement completely I get an acceptable result. It is odd though that the WHEN does work when one changes the code slightly. according to the local expert here (old version expert), the WHEN is/was used for formatting when using a compute.

Thanks!


7.6.11
Windows
HTML, PDF, Excel etc
DevStudio/Webfocus/Focus IBM
SQL Server 2000 / 2008
DB2
September 15, 2008, 06:30 AM
<JG>
quote:
mulipath


multi-verb is the correct description.

WHEN is used for conditional processing on various WebFocus options.

However in this case it was being applied as an IF or WHERE selection.

You've being exploiting a bug for years.
September 15, 2008, 07:21 AM
Jinx
This code works on the new version and produces exactly the same as on old. The WHEN was not used as an IF/WHERE replacement.

TABLE FILE HD1
SUM
 TOTNUM/D12 AS 'TOTAL,NO'
 TOTNET/D12 AS 'TOTAL,NET AMOUNT'
 CLEARNUM/D12  AS 'CLEARED,NO'
 COMPUTE PNO/D12=CLEARNUM*100/TOTNUM;  AS '%'
 CLEARNET/D12 AS 'CLEARED,NET AMT'
 COMPUTE PAMT/D12=CLEARNET*100/TOTNET; AS '%'
BY BOUNCE NOPRINT PAGE-BREAK
BY SECTOR 
SUM
 NO/D12                                AS 'NO'
 AMT/D12                               AS 'NET AMT'
BY BOUNCE NOPRINT
BY SECTOR
ACROSS REJECT AS REJECTIONS
BY SECTOR SUBHEAD
"</1 ** TOTAL **"
WHEN SECTOR EQ 'ZZ'
END  



7.6.11
Windows
HTML, PDF, Excel etc
DevStudio/Webfocus/Focus IBM
SQL Server 2000 / 2008
DB2
September 15, 2008, 07:35 AM
<JG>
 BY SECTOR SUBHEAD
"</1 ** TOTAL **"
WHEN SECTOR EQ 'ZZ'
 

Quite correct Jinks.

My eyes are getting old.

The syntax is wrong, that's the problem.

You need a ';' semi-colon to terminate the WHEN.

Sometimes you get away with it but in a multi-verb request the code tightning
forces the need for the syntax to be correct, and it says it must be there.