Reputation: 1
I'm working with very limited tools, as I'm on our corporate environment trying to create automated reports from our main database. The report designer is a DevExpress that is globally set to C#.
I have two queries that result in separate datatables to be used in building the report. The content of these data tables are in essence the following
+----------+------+-----+ +----------+----------+---------+-----+
| PersonId | Name | ... | | PersonId | JobTitle | Company | ... |
+----------+------+-----+ +----------+----------+---------+-----+
| 1 | John | ... | | 1 | Clerk | ACME | |
+----------+------+-----+ | 1 | Janitor |Umbrella | |
+----------+----------+---------+-----+
So I have a datatable that has personal details of individuals and another table that lists their previous positions. I'm interested in building an automated CV builder, with current and three latest positions in a report page for a given number of people. The issue I have is that I cannot filter the records in Table 2 by the PersonId in Table2 in the DevExpress UI. I can create a one page CV for the people, that beautifully lists all the personal details from table 1, but then inputs ALL records from table 2 and repeats this for all individual CV pages. So as an example, I have three individuals, all with three positions, the report would then give me nine previous positions for all of the candidates.
I've tried to create a calculated field within table 2 and script it to match the PersonId currently in the master page with the PersonId in the detail report. But I can't access the other table from inside where the calculated paramter is being called
private void Previouspositions_GetValue(object sender, DevExpress.XtraReports.UI.GetValueEventArgs e) {
e.Value = Convert.ToString((e.Row as DataRowView).Row["Table1.PersonId"]);
return;
}
The calculated field is able to get the value from "PersonId" but it automatically gets it from Table2. Adding the Table1. prefic gives an error message.
All help is welcome! Thanks in advance
Upvotes: 0
Views: 1131
Reputation: 18290
I prefer to use Master-Detail Report in the scenario. Please follow these examples:
Lesson 3 - Create a Master-Detail Report
How to: Create a Master-Detail Report using Detail Report Bands
How to: Create a Master-Detail Report using Subreports
Upvotes: 1