Focal Point
[SOLVED] EXCEL TEMPLATES

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

February 28, 2014, 04:41 PM
<CSWDT>
[SOLVED] EXCEL TEMPLATES
I am using a template file in one of our reports. I then save the file as a .xls and sent it to a script we have created. The script edits the file, and then resave the file. I have created some sample sudeo code below.

The question I have is that once the script has edited the file is there a way to send the file back to the user similar to using PCHOLD.
Is there a -SET variable I can use, or even some HTMLFORM code I can create to accomplish this?

TABLE FILE CAR
PRINT MODEL
ON TABLE HOLD AS \\templates\TEMPLATE1.MHT FORMAT EXL2K TEMPLATE 'TEMPLATE' SHEETNUMBER 1
END
TABLE FILE CAR
PRINT MAKE
ON TABLE HOLD AS \\templates\FINAL_TEMPLATE.xls FORMAT EXL2K TEMPLATE 'TEMPLATE1' SHEETNUMBER 2
END

DOS \\scripts\edit_excel_template.vbs \\templates\FINAL_TEMPLATE.xls

"send final edited report back to user" \\templates\FINAL_REPORT.xls



thanks for your help!

This message has been edited. Last edited by: <Kathryn Henning>,
March 18, 2014, 02:53 PM
<Kathryn Henning>
Hi CSWDT,

You can use the STATE command to see if the script has run and created the FINAL_REPORT.xls file. If it hasn't been created yet, you can use the SLEEP command to keep testing. An example can be found here:

How to use a focexec to check if a file exists.

Then, once you know that the FINAL_REPORT.xls file exists, you can add a DOS command at the end of the FOCEXEC to copy the file to the desired location:

DOS copy FINAL_REPORT.xls /home/directory/FINAL_REPORT.xls

Cheers!

Kathryn
March 19, 2014, 07:36 AM
Tony A
I would probably suggest using the SYSTEM syntax to make your DOS call as it will wait for the call to complete and pass back a return code. I would then follow this up with an EDAGET command in an attempt to get the file back to the user.

You might hit time outs depending upon your server response in processing the EXCEL file but it's worth a shot.

Both commands have been subjects of previous threads so just use the search link above.

Incidentally, I wrote an article in the IB - Developer Center (link above) that deals with post processing EXCEL templates using VBScript - link.

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