on 04-23-2009 8:51 PM
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>
Hello,
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:
CrystalDecisions.CrystalReports.Engine.ReportDocument.RefreshReport
Or if using RAS then:
CrystalDecisions.ReportAppServer.EnterpriseReportDocument.RefreshReportDocument()
Or from the viewer:
CrystalDecisions.Windows.Forms.CrystalReportViewer.RefreshReport()
Or as Jonathan suggested if you are using a report with saved data you can use SavedData controller...
Thank you
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks to the SAP team for providing me with a solution
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Don,
refresh report most definitely helped. thanks a lot.
Jonathan,
those lines don't appear in my case, I'm running my report in an ASP.net app and no files are generated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi;
There is also a ViewTimeSelectionFormula property that has been known to interfere with selection formulas at runtime.
See if the following helps: [ViewTimeSelectionFormula|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233303334333833393335%7D.do]
Regards,
Jonathan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.