In this series, you will learn the basics of creating a report in the Web Report Designer. This lesson builds on previous articles. To follow along, you will need to have the knowledge learned from previous lessons.
Previousy, you learned about creating a Detail Report band.
In the above image, you can see a customer, Dynamic Solutions Co., with no invoices.
In this lesson, you will learn how to add filters to your report so customers with no invoices will not show.
NOTE: Normally filtering is done at the Method level. In fact, it is best practice to filter the data before it hits the report. So in this case, the report shouldn't filter customers with no invoices to allow for a more flexible report.
However, for the purpose of showing how filters work, we are creating that filter for this report.
Filter the Report
Filtering can apply at many levels. You can filter in individual bands, or you can filter the whole report. In this case, we will filter at the report level.
1. Deselect whatever is selected, so that the Properties on the right will show XtraReport (Report). You will see Filter String with an ellipsis (...).
2. Click the ellipsis (...) beside Filter String, and the Filter Editor pops up.
3. Hover your mouse beside the And, and a green plus appears.
4. Click it, and you will get the choice between Add Group and Add Condition. Select Add Condition.
Remember, a condition is like a question which results in yes or no. In this case, we will ask this question for each record in the report and if the answer is yes, the record will be included in the report. A condition has three parts that need to be defined:
- Blue dropdown: This is the field in the table to look at.
- Green dropdown: This is the operator to be used to compare the blue and grey dropdown.
- Grey dropdown: This is the value used to compare to the blue dropdown.
5. Change each dropdown to add the following condition:
- Field = Balance
- Operation = Does not equal to
- Value = type in the number "0".
Now, this filter will go through each record and compare its Balance to "0". As long as this is not zero, then the record will show up in the report.
6. Save the report and hit Preview. The customers are now filtered to include only those with a postive or negative balance.
Of course, we could style it up a bit. So the next session will fix the fields being displayed.
Styling the Fields
In this next session, you will be styling the report using the same skills you learned from the earlier lessons.
1. First, style the date. Select TxnDate field.
- Set TxnDate's Text Format String to any date format you like. I chose one that didn't display the time.
2. Style the amount. Select the Amount field.
- Set Amount Text Format String to a currency type.
- Still for Amount, find Text Alignment under Appearance, and set it to Top Right.
3. Style the Name field so that it too will stick out. In this example, I style it similar to the report we made in the previous lessons.
4. Add a Group Header band (make sure no band is selected when you do this) and using labels, add some headers for each of the columns. In my example, I added a border on the bottom to underline each label.
5. Save the report and hit Preview.
Show Total Balance
Once last thing we'll do in this lesson: we should show the total balance. We do not need to do any math in this part, because the total balance is already available from the Customer table.
You will put the value in a group footer band, but the band is embedded within the detail report. So it's important to pay attention to what is selected when you add bands or change property values.
1. Select the DetailReport1 band. Again, this is important. Once selected, click the Insert Group Footer icon.
2. From the Field List, drag the Balance field from the Customer table into the group footer you created above. Position it so it's underneath the amount column.
3. Go back to the properties, and select the Customer.Balance field. Change its Text Format string to a currency format.
4. Change the Customer.Balance field's Text Alignment to Top Right.
5. Further style the Customer.Balance field by adding a top border.
6. Finally, drag in a Label control and call it "Total:". Place it to the left of the Customer.Balance field. Style it how you want.
7. Save the report and hit Preview.
In the next article, you will learn about calculated fields.