Dynamically replace the file name of the generated report in printable

Hi Community,

How can I dynamically replace the file name of the report generated in printable, lets say for example i want to put some transaction code or current date time it was generated.

Like 0

Like

4 comments

Dear Fulgen,

As for now this logic is not implemented in out-of-the-box version of the application and we do have a correspondent problem registered for our R&D team and it is in "Accepted" status.



You need to create a replacing schema for PrintReportUtilities and overwrite the current logic. This is the out of the box logic used for naming the file:

    getCaption: function() {

            var baseCaption = this.get("Caption") || this.get("NonLocalizedCaption");

            return baseCaption + ((this.get("ConvertInPDF") || this.isDevExpressReport()) ? ".pdf" : ".docx");

        },



Also you can use function downloadReport (in PrintReportUtilities object):

function downloadReport(caption, key) {

        var report = document.createElement("a");

        report.href = "../rest/ReportService/GetReportFile/" + key;

        report.download = caption;

        document.body.appendChild(report);

        report.click();

        document.body.removeChild(report);

    }

You can try adding this function to section edit page and develop additional logic for report generation.

Best regards,

Oscar

 

Oscar Dylan,

Hi Oscar Thanks for your reply, I tried to create a replacing client module for

PrintReportUtilities but there is a warning message "Substitution of modules is not allowed". Is it possible?

 

Oscar Dylan,

I also used this code on my edit page and changed the report.download to my file name but the file name is not replacing

function downloadReport(caption, key) {

        var report = document.createElement("a");

        report.href = "../rest/ReportService/GetReportFile/" + key;

        report.download = caption;

        document.body.appendChild(report);

        report.click();

        document.body.removeChild(report);

    }

 

Fulgen Ninofranco,

Try to find the answer in the article by the link below.

https://academy.bpmonline.com/documents/technic-sdk/7-13/client-modules

Show all comments