Question:
How can I add date and time to a report’s name, so that every time a report is loaded and exported, a new PDF file is generated with a different title, thus not overwriting the previous PDF file?
Solution:
To do so, it is possible to go to E3Studio and do the following:
- Create a demo tag called CurrentTime and set it up as 3-CurrentTime;
- Create a button on screen, and then add the following script at Click event to export the report:
Set Report = Application.LoadReport(“[Report1]”)
time = FormatDateTime(Application.GetObject(“Data.CurrentTime”), 0)
time = Replace(time, “/”, “-“)
time = Replace(time, ” “, “_”)
time = Replace(time, “:”, “-“)
str = “C:\Report_” & time & “.pdf”
Report.Export “PDF”, str
The result, once the script has been executed and the report has been exported, will look like this: “C:\Report_19-12-2008_11-13-30.pdf”.