Focal Point
[SOLVED] Multiple ON TABLE (PC)HOLD commands with one TABLE request?

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

November 13, 2018, 10:36 AM
jfr99
[SOLVED] Multiple ON TABLE (PC)HOLD commands with one TABLE request?
Hi All,

Can you have multiple HOLD commands with one TABLE request?

I would like to use ReportCaster to create a file that I can copy to a network drive and also have RC distribute a file via email attachment.

RC seems to need the file created by PCHOLD in order to use the file as an attachment to an email. But I would also like to create a file so I can copy/archive it to a network drive.

Can there be multiple HOLD commands in one TABLE request like ...

TABLE FILE CAR
PRINT ...
ON TABLE PCHOLD FORMAT XLSX
ON TABLE HOLD AS WHATEVER FORMAT XLSX
END

This would give me a file ReportCaster would recognize and also a file named "whatever" that I could use for an archived file.

Thoughts?

FYI - I don't want to use 2 TABLE requests.

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


WebFocus 8.201M, Windows, App Studio
November 13, 2018, 10:38 AM
BabakNYC
All signs point to no. Frowner But you can have multiple tasks in one report caster job. So have two TABLE FILE commands one for distribution and one for archive.


WebFOCUS 8206, Unix, Windows
November 13, 2018, 10:45 AM
jfr99
With ON TABLE HOLD AS ... the file gets put in the TEMP directory ... Is there any way to tell ReportCaster to get the file from there? Seems stupid to have to run the TABLE request twice just to get what is needed.


WebFocus 8.201M, Windows, App Studio
November 13, 2018, 10:52 AM
BabakNYC
Unless you use APP HOLD command, the temp file is only there during the session. This is so other executions don't over write the temp file and give you the wrong results. The alternative is to create a staged HOLD file and run two requests off of the HOLD file. This is only if the extraction of the data necessary for the two requests takes a long time. But since you're scheduling this creating 3 tasks, one for extract and 2 for the two hold jobs doesn't seem worth it.


WebFOCUS 8206, Unix, Windows
November 13, 2018, 11:36 AM
jfr99
This is what I remember seeing somewhere ...

If your environment supports the SET parameter SAVEMATRIX, you can preserve the internal
matrix of your last report in order to keep it available for subsequent HOLD, SAVE, and SAVB
commands when the request is followed by Dialogue Manager commands. For details on
SAVEMATRIX, see the Developing Reporting Applications manual.

But I can't find any example of how to use it.

Does anyone know if this works?


WebFocus 8.201M, Windows, App Studio
November 13, 2018, 11:53 AM
MartinY
With only one task in the schedule

-REPEAT TWOFMT FOR &I FROM 1 TO 2
TABLE FILE CAR
PRINT RETAIL_COST
BY COUNTRY
BY CAR
-IF &I EQ 2 THEN GOTO FMT2;
ON TABLE HOLD AS appslocation/FileName FORMAT XLSX
-GOTO ENDFMT
-FMT2
ON TABLE PCHOLD FORMAT XLSX
-ENDFMT
ON TABLE SET BYDISPLAY ON
END
-RUN
-TWOFMT

It's important that the last format in the loop is the PCHOLD one for distribution.


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 13, 2018, 12:04 PM
BabakNYC
I'd never heard of this SET command. Search for SAVEMATRIX in this https://webfocusinfocenter.inf...pdfs4/wfappslang.pdf

Here's what I tried and it worked like a charm:

  
SET SAVEMATRIX=ON
APP HOLD IBISAMP
TABLE FILE CAR
PRINT CAR BY COUNTRY
ON TABLE HOLD AS DELETE_LATER
END
-RUN
PCHOLD FORMAT XLSX
-RUN


I ended up with a delete_later.ftm delete_later.mas in ibisamp and Excel opened with the report output. Seems like all you have to do is run the report and after the END type the next hold command you want by itself.


WebFOCUS 8206, Unix, Windows
November 13, 2018, 12:21 PM
jfr99
Sweet ... Thank You

This worked with ReportCaster as well.


WebFocus 8.201M, Windows, App Studio
November 13, 2018, 01:51 PM
FP Mod Chuck
Good One


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
November 20, 2018, 08:48 AM
Danny-SRL
In fact, you only need the SAVEMATRIX command if you issue some DM commands (which, I do not know) between all your HOLDs/SAVEs.
The following is perfectly legal and has been in use since time immemorial:
  
-SET &ECHO=ALL;
TABLE FILE CAR
PRINT CAR SALES BY COUNTRY
ON TABLE HOLD AS H1
END
HOLD AS H2 FORMAT ALPHA
SAVE AS SA
SAVB AS SB
!TYPE H1.MAS
!TYPE H2.MAS

You will have 4 files which can be used subsequently in the procedure.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

November 29, 2018, 01:14 PM
jfr99
Another issue ... I run the following code via ReportCaster ...

SET SAVEMATRIX=ON
FILEDEF RPTOUT DISK FocalPoint.xlsx
TABLE FILE CAR
HEADING
"Report:   FocalPoint"
"Run Date: &DATEMDYY"
"Run Time: &TOD"
PRINT
COUNTRY
CAR
MODEL
SEATS
DEALER_COST
RETAIL_COST
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE HOLD AS RPTOUT FORMAT XLSX
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty, $
TYPE=REPORT, TITLETEXT='FocalPoint', $
TYPE=HEADING, SIZE=10, JUSTIFY=LEFT, $
ENDSTYLE
END
PCHOLD FORMAT XLSX
-RUN


In my code I also copy the spreadsheet named FocalPoint.xlsx to a network drive so I can keep the file. I also email the file created by the "PCHOLD FORMAT XLSX" statement to myself via ReportCaster. The problem is that both reports are not the same. The report that is copied to the network drive includes styling and a TAB named FocalPoint ... the file attached to the email from ReportCaster has no styling and the Tab name is Sheet1.

Does anyone know how to make both reports the same?

Thanks


WebFocus 8.201M, Windows, App Studio
November 29, 2018, 01:30 PM
MartinY
The method that you used is "out" of the style sheet since the PCHOLD FORMAT XLSX is placed after the ENDSTYLE.

So except if someone else have another option, I suggest that you use the option that I posted on : November 13, 2018 11:53 AM


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 29, 2018, 03:22 PM
jfr99
Hi Martin,

That is what I will do for now.

Thanks


WebFocus 8.201M, Windows, App Studio