Posted 10 September 2019, 5:51 pm EST
Hello Sanjeeb,
As you are adding multiple fields (27 fields) in header section 50,000 times, resulting in 1350000 fields in the report, the task becomes extremely slow and throws out of memory exception.
You can simply create fields as per your records in the Detail section and set the Expression property of the fields as per the name of fields in your object and assign the list of object to the DataSource.Recordset property of FlexReport.
The TextFields are created as follows:
```
TextField textField = new TextField();
textField.Name = “FldID”;
textField.Text.Expression = “Title”;
textField.Left = 0;
textField.Top = 0;
textField.Width = 400;
textField.Height = 300;
c1FlexReport1.Sections.Detail.Fields.Add(textField);
Note that the field is added to Detail section (because that is where we add bound fields that take values from the rows in the DataSource). Here, the Text.Expression property is set, based on the name of the field in the list object.
The DataSource is set as follows:
c1FlexReport1.DataSource.Recordset = pi;
where "pi" is the list object.
This way, you would not have to use loops to set values in fields. This will considerably improve the performance of your application.
Refer the attached application with 2,00,000 records, showing the above implementation.
This will help you modify your application accordingly.
Regards,
Prabhat Sharma.
[zip filename="demo1.zip"]https://gccontent.blob.core.windows.net/forum-uploads/file-805fbdb3-8ea0-4733-a564-37cbdd881c37.zip[/zip]