Crystal Reports Sorting Issue [Resolved]
I am working on my first CR Report in VB.NET and I have the Viewer on my form and the ReportDocument in the
project. I had created the report earlier with 8.5 Developer.
Now the issue is I need to give the user the option of sorting the report on different fields. It currently has two groupings,
say Field1 and Field2. The sorting is ascending on both fields but they want to sort on a third field as the primary sort but
still retain the grouping display but based on Field3 for the sorting.
Ex.
ClientName
Project Name
Description, Created, Assigned, DaysOld
The option is to be able to show the report in descending order based on the DaysOld (Field3) Field, but still be able to view in
alphabetical order if no sorting is desired.
Also, is there a way to display only the data that the user is drilling down on using the explorer tree of the viewer control?
Re: Crystal Reports Sorting Issue
I got the sorting issue worked out by creating a secondary report that is grouped first by the daysold. Added a cbo to the form that
contained both reports. When the user selects one cbo item the viewer reloads that report. If they select the other cbo item then
it reloads with that one.
Next question, what do I need to reference or do before making an installation package?
Also, if I wanted to set the .SetDataSource to an ADO recordset how could I do that? I havent used ADO.NET at all yet. :(
Re: Crystal Reports Sorting Issue
about the .SetDataSource thingy here i created a class that pass the information about your databse.
although it's in C# i know you can convert that to vb.;)
VB Code:
public void loginreport(SqlConnection cn,ReportDocument rpt)
{
CrystalDecisions.Shared.TableLogOnInfo loginfo;
foreach(CrystalDecisions.CrystalReports.Engine.Table table in rpt.Database.Tables)
{
loginfo=table.LogOnInfo;
loginfo.ConnectionInfo.ServerName=cn.DataSource;
loginfo.ConnectionInfo.DatabaseName=cn.Database;
loginfo.ConnectionInfo.UserID="sa";
loginfo.ConnectionInfo.Password="password";
table.ApplyLogOnInfo(loginfo);
rpt.SetDataSource(cn.DataSource);
}
}
if you're using strongly typed dataset no need to put that one..strongly typed will do the login thingy to your database.
hope it helps.
Re: Crystal Reports Sorting Issue
Thanks mar_zim, I see that its still the same as it was in vb6 but how do I connect to my SQL server db? I dont know ad.net at all, only ado vb6.
Re: Crystal Reports Sorting Issue
here's the link for the connection thingy. http://www.connectionstrings.com/
Re: Crystal Reports Sorting Issue
Umm, I know the connectionstring but how do I set up ADO.NET???
I dont know it so could you start from the first step.
Sorry for havent learned it yet. :blush:
Re: Crystal Reports Sorting Issue
No need to set up ADO.Net it is already in the framework.
ADO.NET are good for disconnected objects Dataset,Datatable,datacolumn,datarow and it found on System.Data dll.
sorry I can't give you more detailed explanation about ado.net coz im in a process of knowing more of it.
if you want try to buy "Core Reference Microsoft ADO.NET by David Sceppa"
Re: Crystal Reports Sorting Issue
Thanks Mar. I will continue to search for some more examples. :thumb: