Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

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">



Former Member


Once you have changed or set the record selection formula you'll have to do a Refresh so those changes get applied, otherwise it uses the data in the report. Not sure which engine you are using but this should help:


Or if using RAS then:


Or from the viewer:


Or as Jonathan suggested if you are using a report with saved data you can use SavedData controller...

Thank you


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question