Focal Point
[SOLVED]Scheduled Cache File - Aggregate and Join

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

November 08, 2019, 10:08 AM
Berny
[SOLVED]Scheduled Cache File - Aggregate and Join
We have several reports that use the aggregated data so we are creating a single cache file that runs overnight. Because of our data structure, we need to do two things:

1. Aggregate the data in table A (which has a master file).
2. Join in another table to the aggregated Table A.

For example: Table A shows the sales for the employees in each store. We will aggregate table A to get the total sales for each store. Then we want to join in Table B which has the store address, manager and the store's overall sales goal.

What is the best way to accomplish this?

WebFOCUS 8.2

This message has been edited. Last edited by: Berny,
November 08, 2019, 10:19 AM
FP Mod Chuck
Berny

Use the APP HOLD foldername command (where foldername is a valid application folder in your APP PATH) in the aggregation request that runs with the schedule. Then you will be able to JOIN that in any other request you need to run. I would recommend using FORMAT FOCUS so you don't need to worry about the request finding the actual HOLD file. When it is FORMAT ALPHA or BINARY you would need a FILEDEF for that file in every other request.

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


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
November 08, 2019, 10:37 AM
MartinY
Since you are doing this overnight, can you not just do everything in one pass to then create the hold file ?

Join employees sales per store to store address table then aggregate at the level you want


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 08, 2019, 11:11 AM
Berny
If we do the join before the aggregate, it will inflate the values. I've edited my post to have a better table B. (let's say Table B has store address, manage and the store's overall sales goal)

quote:
Originally posted by MartinY:
Since you are doing this overnight, can you not just do everything in one pass to then create the hold file ?

Join employees sales per store to store address table then aggregate at the level you want

November 08, 2019, 11:50 AM
MartinY
Nope if you are doing something such as this

JOIN STOREID IN SALES TAG T1
  TO STOREID IN STORE TAG T2 AS J1
END

TABLE FILE SALES
SUM SALES
-* Or using another prefix such as MAX, MIN or LST will include the SALES_GOAL value only once and will not SUM the value as many time you have sales records
    FST.SALES_GOAL
BY STOREID
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
November 08, 2019, 12:10 PM
Berny
Really? Thanks I will pass this along!
quote:
Originally posted by MartinY:
Nope if you are doing something such as this

JOIN STOREID IN SALES TAG T1
  TO STOREID IN STORE TAG T2 AS J1
END

TABLE FILE SALES
SUM SALES
-* Or using another prefix such as MAX, MIN or LST will include the SALES_GOAL value only once and will not SUM the value as many time you have sales records
    FST.SALES_GOAL
BY STOREID
END
-RUN

November 08, 2019, 01:03 PM
MartinY
Once resolved, please update your first post then add [SOLVED] at the beginning of the subjest


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