Focal Point
[CLOSED] report code caluculation issue

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

November 17, 2014, 02:58 PM
Jing grace
[CLOSED] report code caluculation issue
I have below report program, the issue is the last calculation step won't get correct result:

DEFINE FILE FACT_CSRPBCLAIM
KEYFIELD/A200V = FACT_CSRPBCLAIM.REGION_NAME | FACT_CSRPBCLAIM.BUILDING_CODE | FACT_CSRPBCLAIM.CLINIC_NAME | FACT_CSRPBCLAIM.CLINIC_SUPERVISOR;

CLM_DATE1/YYMD = HDATE(CLM_PROCESS_DATE, 'YYMD');
STDT/MDYY = CLM_DATE1;
DAY_DOWK/I8YYMD = CLM_DATE1;
CLOSED_DT_DOW/A3=DOWK(DAY_DOWK, 'A3');
STWK/MDYY = DATEMOV (STDT, 'BOW') -2 ;
CLAIMCNT/I5 = 1;

END


TABLE FILE FACT_CSRPBCLAIM
SUM
CNT.INVOICE_NUMBER AS 'CLAIMCNT'
BY KEYFIELD
BY STWK
BY FACT_CSRPBCLAIM.REGION_NAME
BY FACT_CSRPBCLAIM.BUILDING_CODE
BY FACT_CSRPBCLAIM.CLINIC_NAME
BY FACT_CSRPBCLAIM.CLINIC_SUPERVISOR
BY HIGHEST 6 STWK
WHERE FACT_CSRPBCLAIM.REGION_NAME EQ ®ION;
WHERE FACT_CSRPBCLAIM.BUILDING_CODE EQ &SITECD;
WHERE FACT_CSRPBCLAIM.CLINIC_NAME EQ &CLINIC;
WHERE FACT_CSRPBCLAIM.CLINIC_SUPERVISOR EQ &SUPERVISOR;
WHERE CLM_PROCESS_DATE LE '&LASTRUNDATE';
-*WHERE CLM_PROCESS_DATE GE '&6LASTRUNDATE';
WHERE REGION_NAME IS-NOT MISSING;
ON TABLE HOLD AS HINV1 FORMAT FOCUS INDEX KEYFIELD
END
-RUN

JOIN FILE HINV1 AT KEYFIELD TAG CLM TO ALL
FILE HAPPDT AT KEYFIELD TAG APP AS JW1
WHERE CLM.KEYFIELD EQ APP.KEYFIELD;
WHERE CLM.STWK EQ APP.STWK;
END

TABLE FILE HINV1
SUM CLAIMCNT AS '6WKCLMCNT'
APPCNT/D6 AS '6WKMRNCNT'
COMPUTE PPB6/D8.2 = (CLAIMCNT/APPCNT); AS '6WKTRENDPBCLAIM'
BY KEYFIELD
BY REGION_NAME
BY BUILDING_CODE
BY CLINIC_NAME
BY CLINIC_SUPERVISOR
BY STWK
ON TABLE HOLD AS HINV2
END

-**************************************************************************
-* GET CURRENT TOTAL FOR PBCLAIM
-**************************************************************************

TABLE FILE HINV2
SUM 6WKCLMCNT AS 'CURCLMCNT'
6WKMRNCNT AS 'CURMRNCNT'
BY KEYFIELD
BY HIGHEST 1 STWK
BY REGION_NAME
BY BUILDING_CODE
BY CLINIC_NAME
BY CLINIC_SUPERVISOR
ON TABLE HOLD AS HINV3
END

---report code runs correctly here, when I run it I got CURCLMCNT=32 and CURMRNCNT=375 Smiler


JOIN KEYFIELD IN HCSRVOL
TO KEYFIELD IN HINV2 AS M4
END

JOIN KEYFIELD IN HCSRVOL
TO KEYFIELD IN HINV3 AS M5
END
-RUN

TABLE FILE HCSRVOL
SUM
COMPUTE CURPBCLAIMX/D8.2 = (CURCLMCNT / CURMRNCNT); AS ''
COMPUTE 6WKTRENDPBCLAIMX/D8.2 = (6WKCLMCNT / 6WKMRNCNT); AS ''

-- here we have problem the CURCLMCNT / CURMRNCNT accoring for abve is 32/375 =0.08
but I got 0.00 , don't know what is wrong
I am stuck and don't know what to look. can anyone help?

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.6
Windows, All Outputs
November 17, 2014, 03:24 PM
MartinY
What/where is HCSRVOL ?

And can you post all your code from the last table file ?

Remember that a COMPUTE only apply on sorted/filtered data.

A way to debug may be to PRINT * from your last table file and do the math by hand. Sometime is when we're doing it according to the logic we think we've putted in place that we found our issue...


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
November 17, 2014, 04:06 PM
Jing grace
HCSRVOL is th master table. I am joining other 6 tables too, which I took out to make the code shorter so I can focus on the issue.


WebFOCUS 7.6
Windows, All Outputs
November 18, 2014, 06:34 AM
Ian Dalton
quote:
COMPUTE CURPBCLAIMX/D8.2 = (CURCLMCNT / CURMRNCNT); AS ''


why don't you do the above COMPUTE in the previous TABLE.....
TABLE FILE HINV2
SUM 6WKCLMCNT AS 'CURCLMCNT'
6WKMRNCNT AS 'CURMRNCNT'
....COMPUTE in here.....



_______________________
*** WebFOCUS 8.1.05M ***
November 18, 2014, 08:54 AM
Jing grace
I have total and grand total in 3 different level, user requested to get the total by recalculating for each level.


WebFOCUS 7.6
Windows, All Outputs