How to Add Additional Data to a Query Based Report
You can take a classic SSRS approach to add additional data to a SSRS query-based report, which means extending the report query as described in MS documentation.
However, there is another so-called Docentric approach, by using a custom DSP class. However, there is a difference between adding additional data to RDP- (Report Data Provider) based reports and query-based reports.
Namely, you need to override the addAdditionalDataFieldsForQueryRecord() method instead of the addDataFieldsForRdpTableRecord() method which is used for RDP-based reports.
Another difference is that when adding additional data via the addAdditionalDataFieldsForQueryRecord() method, there is no option to remove fields you don’t need.
Let’s take a look at Work report (WHSWork.Report) and how we can add additional data using Docentric approach.
protected void addAdditionalDataFieldsForQueryRecord(DocXmlRecord _addingRecord,
Common _common, QueryBuildDataSource _qbds)
super(_addingRecord, _common, _qbds);
if (tableNum(WHSWorkTable) == _qbds.table())
// TODO: Add here additional fields related to WHSWorkTable, for example CustomerName.
WHSWorkTable workTable = _common;
if (workTable.WorkTransType == WHSWorkTransType::Sales)
SalesTable salesTable = SalesTable::find(workTable.OrderNum);
else if (!this.isRuntime())
// It's not applicable but we'll add it if this executes when DDSP is being produced
// to maintain the uniform data schema.
else if (tableNum(WHSWorkLine) == _qbds.table())
// Add the display method for showing item name of the line
// TODO: Add here additional fields related to WHSWorkLine.
Data Source Generation Options Specifics for Query-Based Reports >>
Example: Query-Based Report Customization >>
Training Lab: Query-Based Report Customization >>
How to Add Additional Data to a Docentric SSRS Report >>