Domanda

I have a report that renders perfectly fine when I am populating it with data. I have complex charts, tables and a lot of data (around 20,000 memory objects). My report rendered perfectly fine untill I added a for loop for some data calculation. The for loop is as follows:

     public void InsertLineBreaks(List<LineChart> inputList, int sampleInterval)
    {
        List<LineChart> breaklinesList = new List<LineChart> { };
        for (int i = 1; i <= inputList.Count; i++)
        {
            if ((inputList[i].X - inputList[i - 1].X).TotalMinutes > sampleInterval)
            {
                LineChart breakline = inputList[i];
                breakline.BreakLine = 1;
                breaklinesList.Add(breakline);
            }
            inputList.AddRange(breaklinesList);

        }

This code basically checks if every data has same interval otherwise adds a breakline. When I add this code, my reportviewer directly shows a blank page without any errors or report controls (next, print, export, etc. buttons). However, if I comment this code out, the report generates just fine without any issues.

I tried debugging the code and put a breakpoint on the data sources. I was surprised to see that the reportviewer still runs and shows a blank page despite the breakpoint. So obviously, the data is not binded and that is why the report viewer is blank.

I suspect reportviewer exceeds the memory allotted to it hence skips my code and data binding and prints blank page. Can anyone help?

È stato utile?

Soluzione

The problem was not with the memory of report builder but with my code. i changed the code to the following and it worked:

public void InsertLineBreaks(List<LineChart> inputList, int sampleInterval)
{
    List<LineChart> breaklinesList = new List<LineChart> { };
    for (int i = 1; i <= inputList.Count; i++)
    {
        if ((inputList[i].X - inputList[i - 1].X).TotalMinutes > sampleInterval)
        {
            LineChart breakline = inputList[i];
            breakline.BreakLine = 1;
            breaklinesList.Add(breakline);
        }

    }
 inputList.AddRange(breaklinesList);

}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top