This is a migrated thread and some comments may be shown as answers.

Report onneeddatasource

1 Answer 77 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
JedF
Top achievements
Rank 1
JedF asked on 09 Nov 2011, 11:09 AM
Hello
This is my code to input data into a table on the report.
The table is linked to a objectdatasource with the same columns
When i bind to the report none of my data comes through

private void monthlyservicesales_NeedDataSource(object sender, EventArgs e)
       {
           var report = (Telerik.Reporting.Processing.Report)sender;
 
           using (var mySql = new MySQL(App.ConnString))
           {
               var data =
                   mySql.QueryDataset(
                       @"SELECT servicetable.Name,count(*) as Total,0 as BWTotal
                                 FROM    axxess.axstable axstable
                                      JOIN
                                         axxess.servicetypetable servicetypetable
                                      ON (axstable.ServiceTypeId = servicetypetable.ServiceTypeId)
                                      join axxess.servicetable ON servicetypetable.ServiceId = axxess.servicetable.ServiceId
                                WHERE     (date_format(axstable.DateCreated,'%Y%M') =  date_format(?0,'%Y%M'))
                                        and axxess.servicetable.Name not like '%*%'
                                    Group by servicetypetable.ServiceId
                                    order by count(*) desc",
                       report.Parameters["datetime"].Value);
 
               var objectDataSource = new Telerik.Reporting.ObjectDataSource();
               objectDataSource.DataSource = data.Tables[0]; // GetData returns a DataSet with three tables
               
               report.DataSource = objectDataSource;
           }
       }

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 09 Nov 2011, 05:22 PM
Hello Jedf,

The Table item is a separate Data Item that has its own DataSource property and respectively its own NeedDataSource event. Also note that you should create the entire table definition with corresponding expressions for the TextBoxes e.g. = Fields.MyField1. The columns of the Table would not "autogenerate" based on the provided data source.

Kind regards,
Steve
the Telerik team

Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.

Tags
General Discussions
Asked by
JedF
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or