[SOLVED] Help with creating temporary templates for EXL2K
Hi,
I have the need to create an excel spreadsheet that has a macro in it, and I also need to create a second tab in addition to this.
I am using WF 8.0.0.7 and in the past I have created an excel spreadsheet using EXL07 and creating a macro with one sheet, and that worked fine.
Now, and I know I said in the subject for EXL2K, but it doesn't matter if I create it in EXL2K or EXL07, as long as I can get it to work.
I referenced an older post here from, I think 2013 about temporary templates, and how to do it, but I haven't been able to get that solution to work.
So here below is the code I am using (from the CAR file).
Thanks.
FILEDEF TEST DISK test.mht
-RUN
TABLE FILE CAR
SUM DEALER_COST
BY BODYTYPE
BY CAR
ACROSS MODEL
ON TABLE HOLD AS TEST FORMAT EXL2K TEMPLATE 'macro2003.xlsm' SHEETNUMBER 1
END
-RUN
FILEDEF TEST2 DISK TEST2.MHT
-RUN
TABLE FILE CAR
PRINT *
BY CAR
ON TABLE PCHOLD AS TEST2 FORMAT EXL2K CLOSE TEMPLATE 'TEST' SHEETNUMBER 1
END
-RUN
-EXIT
I read in the WF 8.0 manual that the .mht file needs to say X-Document-Type: Workbook in line 2 when edited in notepad, and I am seeing that when I edit it.
Not sure why I keep getting the following error: (FOC3289) TEMPLATE FILE: Error opening file (FOC009) INCOMPLETE REQUEST STATEMENT BYPASSING TO END OF COMMAND
Any help would be appreciated.
Thanks.
PaulThis message has been edited. Last edited by: FP Mod Chuck,
WebFOCUS 8 Windows, All Outputs
March 08, 2018, 12:28 PM
Tony A
First of all, you're mixing EXL2K templates and XLSX (EXL07) templates.
The ".mht" file is a web archive type file that was used for EXL2K templates.
The ".xlsm" file would be an XLSX template file that includes macros.
Also, do not forget to change the SHEETNUMBER between sections otherwise you'll end up over-writing your worksheet outputs.
Consider the following code, the initial template file (exl07_template.xltm) must exist within your APP PATH. The first table request uses this file as a starting point and inserts the output into sheet 1 (because of SHEETNUMBER 1 syntax). The AS filename (CAR1) causes a file "car1.xlsm" to be created (within EDATEMP).
The "car1.xlsm" is then used as the template for the second table request which pushes the output into sheet 2 (because of SHEETNUMBER 2 syntax). The output is then saved as "car2.xlsm" which is used as input into the next table request.
... and so on.
The final table request, adds the output to sheet 3 (because of SHEETNUMBER 3 syntax) then sends the output back to the users browser as "exl07_output_20180308_nnnnnn.xlsm" (in the version that I am using - 8.2.01).
SET EMPTYREPORT = ON
TABLE FILE CAR
SUM RCOST
DCOST
BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE HOLD AS CAR1 FORMAT EXL07 TEMPLATE 'exl07_template.xltm' SHEETNUMBER 1
END
-RUN
TABLE FILE CAR
SUM RCOST
DCOST
BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY EQ 'ITALY'
ON TABLE HOLD AS CAR2 FORMAT EXL07 TEMPLATE 'car1.xlsm' SHEETNUMBER 2
END
-RUN
TABLE FILE CAR
SUM RCOST
DCOST
BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY EQ 'W GERMANY'
ON TABLE PCHOLD AS exl07_output FORMAT EXL07 TEMPLATE 'car2.xlsm' SHEETNUMBER 3
END
-RUN
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
March 08, 2018, 12:34 PM
Tony A
Remember to consult the documentation as well. The following link is for 8.1.05 so find the one for your version.
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
March 08, 2018, 01:22 PM
Paul M.
Tony,
Thanks so much.
It is usually the little things that stump me; like when the template says SHEETNUMBER 1 and SHEETNUMBER 2 - I thought that my macro only needed to have a sheet 1 since that is where my macro was. I didn't even have a sheet2 in the .xlsm file (I used .xlsm instead of .xltm).
Once I created a sheet2 in my macro it worked like a charm.
I had thought that it would be automatically created by WF on the second step where SHEETNUMBER 2 was, but I was wrong.
Anyway, long story short, I got it to work and I do appreciate your help.
Have a good day.
Paul
WebFOCUS 8 Windows, All Outputs
March 09, 2018, 05:59 AM
Tony A
Good to hear!
Could you edit your first post and change the subject line to include the prefix [SOLVED],
Thanks
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10