Focal Point
[SOLVED]How to rename the xlsx file dynamically

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

January 28, 2017, 09:28 AM
info4pal
[SOLVED]How to rename the xlsx file dynamically
Hi,

Iam trying to rename the Excel having the extension xlsx using the &RPTSTMP variable but when Iam trying to execute the report,it is getting opened in WFServlet.zip format but if I give as: ON TABLE PCHOLD FORMAT EXL07 FORMAT AS 'Report_name' ,(some static name) I get the report in xlsx format but I want to rename the xlsx dynamically (using &RPTSTMP or any other such variable).

 -SET &REPORT ='Car_report';
-SET &RPTSTMP = &REPORT || '_' || &TOD;
-TYPE RPT is &RPTSTMP

TABLE FILE CAR
PRINT CAR COUNTRY SALES
ON TABLE PCHOLD FORMAT EXL07 FORMAT AS '&RPTSTMP'
ON TABLE SET HTMLENCODE ON
ON TABLE SET STYLE *
TYPE=REPORT,FONT='ARIAL',SIZE=8,GRID=ON,BORDER=1,$
TYPE=TITLE,FONT='ARIAL',SIZE=8,STYLE=BOLD,COLOR='BLACK',JUSTIFY=CENTER,BORDER=1,BACKCOLOR=RGB(169 169 169),$
TYPE=DATA,FONT='ARIAL',SIZE=8,STYLE=NORMAL,BORDER=1,JUSTIFY=LEFT,$
END
-RUN
-EXIT 


Please let me know how to get this done.Thanks a lot in advance!

Thanks&Regards,
IP

This message has been edited. Last edited by: info4pal,


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
January 28, 2017, 01:20 PM
Danny-SRL
quote:
ON TABLE PCHOLD FORMAT EXL07 FORMAT AS '&RPTSTMP'

Sould be
ON TABLE PCHOLD AS '&RPTSTMP' FORMAT EXL07


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

January 30, 2017, 12:05 AM
Avinash
Also you can use '&RPTSTMP.EVAL' to get processed variable value.


Thanks!
@vi

WebFOCUS 8105, Dev Studio 8105, Windows 7, ALL Outputs
January 30, 2017, 12:57 AM
info4pal
Hi Danny and Avinash,

Still Iam not getting the report with the name as specified in the &VARIABLE.It is still showing as WFServlet.zip...

Please let me know how to open it in xlsx format
with the different file name each time.

Thanks a lot in advance for all you help.

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
January 30, 2017, 05:47 AM
Maran
Hi IP,

The problem is &TOD value. hours, mins & seconds values are separated by "." . If you replace the "." with "_" then you may get the Excel file name.

This message has been edited. Last edited by: Maran,


WebFOCUS 8201m
Windows,AppStudio, DevStudio,All Outputs
January 30, 2017, 07:12 AM
eric.woerle
Info4pal, you need to adjust your redirection setting for that file type. I believe it needs to be set to "save" for that file type to save to the server first.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
January 30, 2017, 07:42 AM
info4pal
Hi All,

Maran's tips worked and thanks everyone also Smiler
But actually I have a drilldown report and once I click on the hyperlink, the renaming of the sheet works fine but again if I click on the same hyperlink, it gives me this pop up message saying :

A document with the name 'car_report_06_37_49.xlsx' is already open.You cannot
open two documents with the same name,even if the documents are in different folders.
To open the second document,either close the document that's currentky open,or rename one of the documents.

My end users do not wish to see this message if they click on the same hyperlink.

Is there any workaround for not showing up this message? Please let me know.

Thanks a lot in advance!

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
January 30, 2017, 10:45 AM
Avinash
quote:
ON TABLE PCHOLD AS '&RPTSTMP' FORMAT EXL07



Hi IP,

You can use below code that will give dynamic excel name with no servelet.

-SET &REPORT ='Car_report';
-SET &RPTSTMP = &REPORT || '_' || &YYMD || '_'|| &TOD;
-SET &RPTSTMP = STRREP(&RPTSTMP.LENGTH, &RPTSTMP, 1, '.', 1, '_', &RPTSTMP.LENGTH, 'A&RPTSTMP.LENGTH');
-TYPE RPT is &RPTSTMP

TABLE FILE CAR
PRINT CAR COUNTRY SALES
ON TABLE PCHOLD AS '&RPTSTMP' FORMAT EXL07
ON TABLE SET HTMLENCODE ON
ON TABLE SET STYLE *
TYPE=REPORT,FONT='ARIAL',SIZE=8,GRID=ON,BORDER=1,$
TYPE=TITLE,FONT='ARIAL',SIZE=8,STYLE=BOLD,COLOR='BLACK',JUSTIFY=CENTER,BORDER=1,BACKCOLOR=RGB(169 169 169),$
TYPE=DATA,FONT='ARIAL',SIZE=8,STYLE=NORMAL,BORDER=1,JUSTIFY=LEFT,$
END
-RUN
-EXIT


Thanks!
@vi

WebFOCUS 8105, Dev Studio 8105, Windows 7, ALL Outputs
January 30, 2017, 01:11 PM
Doug
OR:
-SET &HHMMSS = EDIT(&TOD,'99$99$99');
... TABLE FILE...
ON TABLE PCHOLD AS 'Car_Report_&YYMD.EVAL_&HHMMSS' FORMAT EXL07
... END
"HHMMSS" is so useful...
January 30, 2017, 11:40 PM
Maran
IP,

Are you generating excel output in drill down fex...?
If you want the current time values in excel name when you click the hyperlink..the &RPTSTMP variable should be refreshed to fetch the current time in the &TOD variable.

If you generate the &RPTSTMP variable in drill down fex..you will get the current time values in excel filename when you click the hyperlink.


WebFOCUS 8201m
Windows,AppStudio, DevStudio,All Outputs
January 31, 2017, 06:50 AM
info4pal
Hi,

Avinash and Doug - Iam still getting the same error message/pop up message once I click on the already clicked hyperlink in the summary report.

Eric - The end users want to open the file rather than saving it everytime.

Maran - Iam trying to eliminate the pop up message and Iam trying to rename the excel sheet with the extension .xlsx dynamically.

Please let me know any other workaround for not getting the pop up message.

Thanks a lot in advance for all your help.

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
January 31, 2017, 11:56 AM
Avinash
Hi IP,

Can you share your code via CAR sample file. Means both fexs - Main report and drill down report. Just wanted to see that what you are trying to achieve.

Below are the sample code and i clicked multiple time and it allowed me to open multiple excel file.

-*==============Main Report=========================
TABLE FILE CAR
SUM SALARY
BY CAR
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
TYPE=DATA,
COLUMN=N1,
FOCEXEC=IBFS:/WFC/Repository/Public/DrillDownReport.fex,
TARGET='_self',
$
ENDSTYLE
END


-*===============DrillDownReport================

-* File: IBFS:/localhost/WFC/Repository/Public/Procedure2.fex Created by WebFOCUS AppStudio
-SET &REPORT ='Car_report';
-SET &RPTSTMP = &REPORT || '_' || &YYMD || '_'|| &TOD;
-SET &RPTSTMP = STRREP(&RPTSTMP.LENGTH, &RPTSTMP, 1, '.', 1, '_', &RPTSTMP.LENGTH, 'A&RPTSTMP.LENGTH');
-TYPE RPT is &RPTSTMP


TABLE FILE CAR
SUM SALARY
BY CAR
ON TABLE PCHOLD AS '&RPTSTMP' FORMAT EXL07
ON TABLE SET HTMLENCODE ON
ON TABLE SET STYLE *
TYPE=REPORT,FONT='ARIAL',SIZE=8,GRID=ON,BORDER=1,$
TYPE=TITLE,FONT='ARIAL',SIZE=8,STYLE=BOLD,COLOR='BLACK',JUSTIFY=CENTER,BORDER=1,BACKCOLOR=RGB(169 169 169),$
TYPE=DATA,FONT='ARIAL',SIZE=8,STYLE=NORMAL,BORDER=1,JUSTIFY=LEFT,$
END
-RUN
-EXIT


I am hoping that it will solve your problem.


Thanks!
@vi

WebFOCUS 8105, Dev Studio 8105, Windows 7, ALL Outputs
February 01, 2017, 01:41 AM
info4pal
Hi,

Thanks a lot everyone Smiler
It helped!

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML