Crystal Reports CSV Export Filtering by Date (C # MySQL)

1

I have a Crystal Report object that is bringing the records of a View from a MySQL database. I need these records to be exported to a CSV file and I got this with the following code:

private void btnExportarCSV_Click(object sender, EventArgs e)
{
        string fileName = DateTime.Today.ToString("yyyyMMdd") + ".csv";
        fileName = Config.pathFiles + "\" + fileName;
        Reports.NotaFiscal_CSVReport cr = new Reports.NotaFiscal_CSVReport();

        DiskFileDestinationOptions diskOpts = ExportOptions.CreateDiskFileDestinationOptions();
        diskOpts.DiskFileName = fileName;

        CharacterSeparatedValuesFormatOptions csvFO = ExportOptions.CreateCharacterSeparatedValuesFormatOptions();
        csvFO.ReportSectionsOption = CsvExportSectionsOption.ExportIsolated;
        csvFO.ExportMode = CsvExportMode.Standard;
        csvFO.SeparatorText = ";";
        csvFO.Delimiter = "";

        ExportOptions exportOpts = new ExportOptions();
        exportOpts.ExportFormatType = ExportFormatType.CharacterSeparatedValues;
        exportOpts.ExportFormatOptions = csvFO;
        exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
        exportOpts.ExportDestinationOptions = diskOpts;

        cr.Export(exportOpts);

}

The problem is that there is a field in this view that is a date. And I need the report to export only the records whose date is in a specified range. I tried to do this in many ways, with parameters, formulas ... but without success.

Does anyone know the right way to do this? Remembering that the report is linked to a view, the report dataset is not being set in the code ...

Thanks!

    
asked by anonymous 28.03.2016 / 00:17

0 answers