Combine data from two datasources
Posted: Fri Apr 24, 2020 10:44 am
Hello,
I have a report with two different SQL Data Connections. Each Data Connection has one datasource. Both datasources
contain the same type of information (Equipment Name and Runtime hours), but from different periods of time. I would
like to be able to combine the two datasources into a third datasource.
Is it possible to create a new DataTable in the report with columns for EquipmentName and RuntimeHours and then in
the report BeginRender event loop through the rows from each datasource and populate the DataTable?
Perhaps using something like the following pseudo code...
rows = this.Dictionary.DataSources["DataSource1].Rows[]
for each row in rows
DataTable.Add(row(this.Dictionary.DataSources["DataSource1"].Columns["EquipmentName"],this.Dictionary.DataSources["DataSource1"].Columns["RuntimeHours"]))
rows.next()
rows = this.Dictionary.DataSources["DataSource2].Rows[]
for each row in rows
DataTable.Add(row(this.Dictionary.DataSources["DataSource2"].Columns["EquipmentName"],this.Dictionary.DataSources["DataSource2"].Columns["RuntimeHours"]))
rows.next()
Thanks,
Carl
I have a report with two different SQL Data Connections. Each Data Connection has one datasource. Both datasources
contain the same type of information (Equipment Name and Runtime hours), but from different periods of time. I would
like to be able to combine the two datasources into a third datasource.
Is it possible to create a new DataTable in the report with columns for EquipmentName and RuntimeHours and then in
the report BeginRender event loop through the rows from each datasource and populate the DataTable?
Perhaps using something like the following pseudo code...
rows = this.Dictionary.DataSources["DataSource1].Rows[]
for each row in rows
DataTable.Add(row(this.Dictionary.DataSources["DataSource1"].Columns["EquipmentName"],this.Dictionary.DataSources["DataSource1"].Columns["RuntimeHours"]))
rows.next()
rows = this.Dictionary.DataSources["DataSource2].Rows[]
for each row in rows
DataTable.Add(row(this.Dictionary.DataSources["DataSource2"].Columns["EquipmentName"],this.Dictionary.DataSources["DataSource2"].Columns["RuntimeHours"]))
rows.next()
Thanks,
Carl