Focal Point
[SOLVED] Filtering HDIFF results

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

July 19, 2017, 11:26 AM
Jason68
[SOLVED] Filtering HDIFF results
I have a compute of HGETC ( 10 , 'HYYMDm' ) with a format of HMDYY.S and I have a second compute of HDIFF ( Compute_1 , DT_TM_END , 'HOURS' , 'D12.0' ) . I have tried using LE a numeric value in the second compute but it will not bring back the results, it brings back all results. I am trying to limit the search to say 60 hours between the two dates. I want the ability to bring data within a certain amount of hours between NOW and a table that has transactions going back 90 days.

This message has been edited. Last edited by: FP Mod Chuck,


Webfocus
July 19, 2017, 12:43 PM
FP Mod Chuck
Hi Jason68

First of all welcome to Focal Point. I see you have been a member for quite a while but this is your first post...

WebFOCUS gets all the results of the request and then does the computes. Although I have never tried to filter on the results of two computes I don't think it will work. Hopefully someone else will have some insight to this.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
July 19, 2017, 12:53 PM
BabakNYC
In order to debug your code, you should remove the WHERE test and see what the computed value is. Does the calculation look right?

Also, try a DEFINE instead of a COMPUTE. DEFINE will generate a value for each database row.

It would be terrific if you could create a very simple example and post the code here so we understand what you're doing.


WebFOCUS 8206, Unix, Windows
July 19, 2017, 01:44 PM
MartinY
As Babak suggested, once you are sure that your COMPUTEs return the proper value, you can create a third one to perform the difference between the first two then use
WHERE TOTAL ThirdCompute LE xx;


Such as this sample :
TABLE FILE CAR
SUM RETAIL_COST
    DEALER_COST
    COMPUTE NRET /P6C = RETAIL_COST / 10;
    COMPUTE NDEL /P6C = DEALER_COST / 2;
    COMPUTE DIF  /P6C = NDEL - NRET;
BY CAR
BY MODEL
WHERE TOTAL DIF GT 3000;
END
-RUN



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