Focal Point
[SOLVED] 3 procedures 1 dashboard

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

August 02, 2017, 10:14 AM
Shingles
[SOLVED] 3 procedures 1 dashboard
Hi All,

I've got a scenario where I have multiple procedures in a single dashboard. They all use the same HOLD file, but not really... You see they each compute the same hold file (I copied and pasted the code to create the HOLD file into each procedure). I have to think that this is not efficient.

There must be a way where I can compute the HOLD file once, and then all the other procedures within the dashboard use that same HOLD file (so they don't calculate it as well).

In case this is important, I also have an HTML file where I have the prompt/parameter selections.

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


WebFOCUS 8201, SP 0.1, Windows 7, HTML
August 02, 2017, 01:01 PM
FP Mod Chuck
Hi Shingles

One option you may consider is to use InfoAssist to create the reports in a document. The first report can create the HOLD file and then the rest of the reports can use that same hold file for reporting. You can apply where filters that prompt for parameters and once you save it you can use app studio to create a html file to run it.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
August 03, 2017, 09:00 AM
Shingles
Hey Chuck,
Thanks for the response. I was thinking of doing exactly that. However, its not working. Like, what exactly is the 'first' report anyhow?

I tried taking out the bit of code that creates the HOLD file in all the procedures, except for the 'first' one. But when I run it, the other procedures don't find the HOLD file. Is there a path I need to use to find the HOLD file. Or perhaps I'm supposed to use some specific syntax when creating the HOLD file?


WebFOCUS 8201, SP 0.1, Windows 7, HTML
August 03, 2017, 09:26 AM
Fernando
Shingles, You could create a separate fex that only creates your hold file. Then using javascript run it. Your dashboard would need to have the other reports set to not be automatically run. Once your creation fex is done then using javascript you can kick off the others.

Fernando


Prod WF 8.1.04, QA WF 8.2.03, Dev WF 8.2.03
August 03, 2017, 10:21 AM
MathematicalRob
I just built a dashboard with multiple pages, and used this approach. A single report on the first page creates the hold file (saved to FOCCACHE), and then all the other reports are on separate pages, so that they run later, when the page is visited.

- Rob


WebFocus 8201m on Windows; App Studio 8201; Procedures: WebFocus with SQL; HTML Parameter Pages & Dashboard; Output: Excel, HTML, & PDF.
August 03, 2017, 10:25 AM
FP Mod Chuck
Shingles

When you start an InfoAssist report you create the content you want in the hold file and then choose the File button which creates the hold file. After that the hold file is what is displayed to choose the content for the remaining reports. I think you need to start from scratch for this to work.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
August 04, 2017, 02:48 PM
dbeagan
You could have a procedure like this which checks for or creates the HOLD file.

rephold0.fex
 
 APP HOLD foccache
 FILEDEF repdata DISK foccache/repdata.ftm
 STATE foccache/repdata.ftm
-RUN
-IF &RETCODE EQ 0 THEN GOTO Done;
 TABLE FILE ggsales
 SUM UNITS DOLLARS
 COMPUTE TimeStamp/A8 = '&TOD';
 BY REGION BY ST
 BY CATEGORY BY PCD
 ON TABLE HOLD AS repdata
 END
-Done

Each report just needs to -INCLUDE the above. The include assumes rephold0.fex is in the Public domain.

rephold1.fex
  
-INCLUDE IBFS:/WFC/Repository/Public/rephold0.fex
 SET PAGE=NOLEAD,STYLE=ENDEFLT
 TABLE FILE repdata
 SUM UNITS DOLLARS TimeStamp
 BY REGION BY ST
 END


rephold2.fex
  
-INCLUDE IBFS:/WFC/Repository/Public/rephold0.fex
 SET PAGE=NOLEAD,STYLE=ENDEFLT
 TABLE FILE repdata
 SUM UNITS DOLLARS TimeStamp
 BY CATEGORY BY PCD
 END



WebFOCUS 8.2.06
August 04, 2017, 02:55 PM
MartinY
dbeagan, this is the solution when you don't care to extract data from DB several times.
Shingles is looking for a solution that will generates the data only once to be then reused multiple times.


Shingles, does you HOLD file (extracted data) can be processed from a batch or does it depend on user's selection ?
Is there any manner where you can extract the core data and perform the COMPUTEs in a batch, HOLD the file then have the dashboard/report use the HOLD file to apply filters ? In other words : create a kind of DataMart to be used be your dashboard.


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
August 04, 2017, 02:57 PM
Shingles
Thanks dbeagen,
I was talking to an IBI consultant about this (it sort of came up) and he suggested doing something like. I like this approach.

Thanks!


WebFOCUS 8201, SP 0.1, Windows 7, HTML
August 04, 2017, 03:29 PM
Shingles
quote:
Originally posted by MartinY:
dbeagan, this is the solution when you don't care to extract data from DB several times.
Shingles is looking for a solution that will generates the data only once to be then reused multiple times.


Shingles, does you HOLD file (extracted data) can be processed from a batch or does it depend on user's selection ?
Is there any manner where you can extract the core data and perform the COMPUTEs in a batch, HOLD the file then have the dashboard/report use the HOLD file to apply filters ? In other words : create a kind of DataMart to be used be your dashboard.


This is how I see this working (I'm using pseudo code, so the syntax is not right)...

proc01.fex
-IF FOCCACHE/CAR_SALES.EXISTS EQ 1 GOTO :DATA_EXTRACT;
TABLE FILE CAR
SUM SALES
ON TABLE HOLD AS FOCCACHE/CAR_SALES
END
-:DATA_EXTRACT


proc02.fex
-INCLUDE proc01.fex
TABLE FILE FOCCACHE/CAR_SALES
PRINT *
END


proc03.fex
-INCLUDE proc01.fex
TABLE FILE FOCCACHE/CAR_SALES
PRINT *
END


So every time the procs are run, they will check if the HOLD file exists. If they exist, then great, just use it and don't query the DB. If it doesn't then generate the HOLD file. Will this not work? I haven't had the chance to test 'cause I'm working on more pressing things at the moment.

The HOLD file is dependent on user interaction.


WebFOCUS 8201, SP 0.1, Windows 7, HTML
August 08, 2017, 05:04 PM
Hawk
You could create a compound document that calls the three report. Save it then edit it using text editor and create the hold file before you see the code that creates the compound document.


WebFOCUS 8.2.01M
Windows, All Outputs
August 08, 2017, 06:21 PM
Doug
Or, that "compound document that calls the three reports" can contain an initial fex which creates only the hold file (no report). Or you can create a fex which creates the hold file and -INCLUDE it in the first report to accomplish the same result.




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
August 09, 2017, 08:20 AM
MartinY
quote:

So every time the procs are run, they will check if the HOLD file exists. If they exist, then great, just use it and don't query the DB. If it doesn't then generate the HOLD file.


The above is true for a certain period of time. Files in FOCCACHE are cleared automatically by the system.
This is something configured in the client setting. If I remember well it's the "IBI_Cache_Effective_Policy_Duration".


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
August 09, 2017, 09:55 AM
Doug
Or, you can use the APP HOLDMETA / APP HOLDDATA command if you want o make these permanent hold files. If you do that, you need to ensure that they have significant file names that no one else will be using them as they will either get or overwrite your files. These commands work with "ON TABLE HOLD AS [filaname] FORMAT FOCUS".
August 15, 2017, 02:43 PM
RobertF
not sure this helps but we have designed our stuff to have two buttons on a given tab. The first, using whatever filtering is appropriate generates the data into a Hold file; Format Focus--- so it hangs around. Then other button/s may be pressed that go againstt the hold file.


WebFOCUS 8206.08
Windows, All Outputs
May 28, 2019, 04:28 PM
Shingles
Hey Folks,

So I'm resurrecting this thread... I'm using some of what what discussed here but I'm hitting a wall.

Consider a dashboard made up of several fex files. PROC1.fex and PROC2.fex are each in their own panels on the dashboard. PROC1 is quite big and complicated and does quite a bit of processing. PROC2 just needs to report some summary data that PROC1 already calculates.

At the end of PROC1 I create a FOCCACHE HOLD file, let's call it FOCCACHE/HOLD_ME.

I've been able to get PROC2 to use FOCCACHE/HOLD_ME (great success), but the problem I'm having is that PROC1 takes much longer to execute. So PROC2 only shows summary data for PROC1's previous execution... they are out of synch.

Is there a way to run PROC2 only after PROC1 updates the FOCCACHE/HOLD_ME file?

I've tried using global variables, but we can't manipulate global variables (am I wrong?)... so really they should be called constants.

I've tried adding a boolean field in the HOLD_ME file that could be used to tell PROC2 when HOLD_ME has been updated, but that ain't working either. I can't remember what the hold up was there to be honest.

Any tips?


WebFOCUS 8201, SP 0.1, Windows 7, HTML
May 29, 2019, 07:25 AM
MartinY
Does PROC1 data depend on user selection ?

If not, one thing you can do is to have PROC1 data built over night using RC. That way the data will also be available for PROC2.
If your data may change during the day, you can have your schedule ran multiple time per day and then have your dashboard with an auto-refresh.

Probably several possible options, but since we don't have the whole specs difficult to provide a complete solution.
Reading back the original treads you have several options discussed.


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
May 29, 2019, 08:30 AM
Shingles
Thanks for the reply MartinY. That approach won't work though. Users have several parameters that they can change and the submit. With the approach that you have provided, PROC2 will still show summary data for PROC1's previous execution.


WebFOCUS 8201, SP 0.1, Windows 7, HTML
May 29, 2019, 09:36 AM
MartinY
If none of the above previously given suggestions works, you may have to reconsider the way your dashboard is built.

Another solution (which is what you are trying to avoid, and sometime we don't have choice) is to also have PROC2 performing the same extraction as PROC1 and not relying on PROC1 result.
It will result of querying twice the BD and takes longer time to process, but at least both reports will display the proper result based on user selection.


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