Link to home
Start Free TrialLog in
Avatar of apramod
apramodFlag for United States Minor Outlying Islands

asked on

How do i place more than one chart in crystal reports using xsd

I have created a crystal report with 2 charts. For this i have pulled data from xsd file which contains two datatables. Those two charts get filled with these two tables.

My problem is when i run the report these two charts getting linked and data is changing in the charts depending upon link.

I am getting data from datatables correctly. But when shown in charts they are changing.? Can any one give solution.
MySqlConnection sqlConn = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLConnectionstring"].ToString());
                MySqlCommand comd;
                comd = new MySqlCommand();
                comd.Connection = sqlConn;
                comd.CommandType = CommandType.StoredProcedure;
                comd.CommandText = "usp_AreaByWeek";
 
                comd.Parameters.Add("?ProjID", MySqlDbType.Int32);
                comd.Parameters.Add("?inputDate", MySqlDbType.Datetime.ToString());
                comd.Parameters[0].Value = Convert.ToInt32(ddlProjTitle.SelectedItem.Value);
                comd.Parameters[1].Value = DateTime.Parse(txtStartDate.Text).ToString("yyyy-MM-dd");
if (ds.Tables[2].Rows.Count > 0 || ds.Tables[3].Rows.Count > 0)
                        {
                            myreport.Load(Server.MapPath("Reports\\SampleAreaByWeek.rpt"));
                            myreport.Database.Tables[0].SetDataSource(ds.Tables[3]);
                            myreport.Database.Tables[1].SetDataSource(ds.Tables[2]);
 
 
                            CrystalReportViewer1.Visible = true;                           
                            CrystalReportViewer1.ReportSource = myreport;
                                                   }

Open in new window

Avatar of Mike McCracken
Mike McCracken

Where do you assign DS1 and DS2?

Are you using 2 data sourcesw for the report?
In general this is not supported by Crystal.
You probably need to put one in a subreport.

Are the charts in the same section?

mlmcc
Avatar of apramod

ASKER

I am pulling the data from two stored procedures into a xsd file.
I missed the two lines of code there where i initialize the dataset ds.
From xsd file i have taken two tables(one for each stored proc) and passing it to crystal report.

I am using only one datasource.
As i said when you place two charts they are getting linked either by two common column text or value, so even if you use subreport then also they will be linked? If they are linked data changes.

ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I believe the answer of using subreports is the way you need to go.  In each subreport you select 1 table so there is no link made between the tables.

mlmcc