Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create an unbound subreport in another unbound report
    text
    copied!<p>I have an unbound XtraReport that has a subreport control which contains another report. I call "unbound" to a report that has the definition of the fields using a schema but not actually bound to any DataSet, I create a DataTable using a Data Access Layer and then pass that object to the DataSource property of the report.</p> <p>So, I have the following code:</p> <pre><code> // (...) Get the data from the db and fill a DataTable if (table.Rows.Count &gt; 0) { report.DataSource = table; // (...) Get the data from the db and fill a DataTable for the subreport report.SubPurchaseOrder.Report.DataSource = tableSubReport; report.ShowPreviewDialog(); } else { MessageBox.Show("No data to show."); } </code></pre> <p>But what I get using this approach is the subreport printed very oddly (take a look at the <a href="http://www.4shared.com/file/136123474/c2cd53a3/PurchaseOrder.html" rel="nofollow noreferrer">attached pdf</a>, sorry it's in spanish but I think you get the idea).</p> <p>I've read the DevExpress documentation and maybe I'm not getting the approach right, so my question to you is how to create a report that has one or more subreports but I have to provide the data to fill them using some process external to the reports, such as a Data Access Layer?</p> <p>Please let me know if the question is not stated correctly or lacks of more info.</p> <p>EDIT:</p> <p>I uploaded a sample project with the report with problem <a href="http://www.4shared.com/file/136401686/28dbf076/ReportsDevexpress.html" rel="nofollow noreferrer">here</a>.</p> <p>I've tried to use parameters of some kind. In the BeforePrint event of the subreport control, I tried:</p> <pre><code>((XRSubreport)sender).ReportSource.FilterString = "[IdPO_RO] = " + _idPurchaseOrder; </code></pre> <p>and</p> <pre><code>((XRSubreport)sender).ReportSource.Parameters["Id"].Value = _idPurchaseOrder; </code></pre> <p>Of course, for the second, I added a parameter and the filter string the same as the first but using the parameter.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload