Skip to Content
0
Former Member
Apr 23, 2009 at 07:51 PM

Baffling Situation: When Report Initially Loads with No Data...

30 Views

I haven't been able to make sense of this situation. I made sure no caching is happening as I will show in the following snippets. When my report loads with no data, no subsequent change of "RecordSelectionFormula" can make the report show any records.

However, if i widen my initial range data shows up and after that I can change it to any range I want.

There is nothing wrong with the logic at all. I am selecting a whole bunch of records based on a given date range. The date range below is set to say 30 days initially.

If the inital load comes as empty, no other changes in the date range can make the report show. However if I initially set the date range to a wider value, subsequent changes in the range accurately apply.

I removed any auxilliary piece of code such as the code to change the database connection. The report itself works flawlessly in the designer, even after setting the record selection to the text composed below.

  • Filter logic in my code behind:

if (!String.IsNullOrEmpty(fromDate) && !String.IsNullOrEmpty(toDate))

crystalReportSource.ReportDocument.DataDefinition.RecordSelectionFormula =

String.Format("{{VwAllEventLogs.DateCreated}} in Date('') to Date('')", fromDate, toDate);

  • code in my page .aspx:

<cr:CrystalReportViewer ID="crystalReportViewer" runat="server"

EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False"

GroupTreeImagesFolderUrl="" HasCrystalLogo="False" HasDrillUpButton="False"

HasPrintButton="False" HasSearchButton="False" HasZoomFactorList="False"

Height="1158px" ToolbarImagesFolderUrl=""

ToolPanelWidth="200px" Width="1059px" ShowAllPageIds="True"

ToolPanelView="None" HasToggleParameterPanelButton="False"

HasDrilldownTabs="False" HasToggleGroupTreeButton="False"

AutoDataBind="True" ReportSourceID="crystalReportSource" />

<cr:CrystalReportSource ID="crystalReportSource" runat="server">

<Report FileName="~/Log/AuditLog.rpt">

</Report>

</cr:CrystalReportSource>