Page 1 of 1

Add a dynamic date to file name

Posted: Wed Oct 20, 2021 6:25 am
by Bisoux
Hi everyone,

I have a requirement where i need to dynamically add a date field to the filename at the time of export.

So the file name should look like "filename 202110". The dynamic part is the year + current month after filename.

The script language on the report is set to CSharp but I can switch that if required.

On the code page of the report i see the following,

Code: Select all

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;

namespace Reports
{
    public class n10425859SL : Stimulsoft.Report.StiReport
    {
        public n10425859SL()        {
            this.InitializeComponent();
						
        }

        #region StiReport Designer generated code - do not modify
        #endregion StiReport Designer generated code - do not modify
		
	
    }
}

I have seen one post here where the solution suggested was,

Code: Select all

viewer.addEventListener(StiViewerEvent.START_EXPORT, onStaerExport);

... 

private function onRetrieveColumns(event: StiViewerEvent): void
{
    event.report.reportFile = event.report.reportName + StiDateTime.now.toString("YYYY-MM-dd");
}
I tried to implement this but i am not getting the required result. Can you please share sample mrt files where you have implemented this requirement or direct me to an answer for this that was posted here previously. I am using Stimulsoft Designer Version 2021.3.1, WinFomrs , .NET 4.5

Thank you

Re: Add a dynamic date to file name

Posted: Wed Oct 20, 2021 7:55 am
by HighAley
Hello,

It needs some time.
Please, send us a request and we will prepare a report for you.

Thank you.

Re: Add a dynamic date to file name

Posted: Wed Oct 20, 2021 11:18 am
by Bisoux
Hello,

If you dont have a report it is fine. If you can tell me where in the code i need to specify the dynamic file name that will also work for me. If it is not possible to have dynamic file names do let me know as well.

Thank you

Re: Add a dynamic date to file name

Posted: Thu Oct 21, 2021 2:23 pm
by HighAley
Hello,

Please, send us a request and we will send your all necessary information.

Thank you.