Group and crystal reports
I have a crystal report that looks like this:
Group By Property.ID
Group By RentalUnit.PropertyID
Group By Tenant.PropertyID
So it looks something like this:
Property1
unit1 data, tenant data
unit2 data, tenant data
...
unitN data, tenant data
Property2
unit1 data, tenant data
unit2 data, tenant data
...
unitN data, tenant data
...
PropertyN
unit1 data, tenant data
unit2 data, tenant data
...
unitN data, tenant data
The tables look like this:
Property:
ID
other data
RentalUnit
ID
PropertyId <-- This is the foreign key representing what property they belong to
other data
Tenant
ID
PropertyID <-- foreign key to their property
UnitNumber <-- foreign key to their unit
other data
I want to change the report. I am passing the call variable SelectedPropertyID to it and I want to show only the rental units (and the tenant assigned to the landlord) for the selected property.
How can i do this? I am new to crystal reporting, so please excuse my inexperience.
0
a source to share
1 answer
OK, I just updated my memory in Crystal Reports. I'm on version XI R2, so your version might be different.
Here's what I did:
- Define a parameter for the property identifier. It is up to you to define it as a free field or to limit its values to what is in the database. What's the point in your report.
- Open a database expert. Click on the "Links" tab and make sure you have links defined between these tables. If you don't, define them (think of them as foreign keys). Close the database expert.
- Open the expert of choice. Click new to define a new selection constraint. In the new window that appears, drag your parameter and the Property ID field from the tblProperty table with an equal icon between them. It's basically a report
WHERE
. Your formula should look something like this{?Parameter}={tblProperty.PropertyID}
.
And that should do it.
+3
a source to share