|
|
|||
Home Products Downloads Registered users Support Prices Order Primary Subscription |
|
||
Options in a list rangeYou can use only simple range options in an arbitrary range (excluding an AutoFilter that is used in a list range only, as you may recall). This isn't an XL Report restriction - it is an Excel restriction. You need to understand that all the Excel capabilities in data grouping, analyzing, and filtering are based on list processing methods. Sorting, totaling, grouping, etc. are done not by XL Report but by Excel itself, so the existing restrictions on the report design are Excel restrictions. Remember the main thing - if you would like to total, filter, sort, group etc. you have to create and use list ranges (or just lists in Excel terminology - see Appendix A). We refer to a lot of Excel documentation here; that's because we plan to talk about things that are probably well known. Now we'll begin. Sorting in a list rangeWhere? QDemo.dpr form: frmLists1; unit: fLists1; template: tLists1.xls Just use the Sort option in the option cell of the columns that are needed. We opened the previous form, opened the template, and deleted all options in the OrdersRange range. In the option cell of the PaymentMethod we put the Sort option. There was no previous sorting in this range. The primary key of the Orders table provided the default sorting. Now the report is sorted on the PaymentMethod column. You can sort the column in descending order by adding the Desc option to the Sort option and separating them by semicolon. ![]() Sorting in XL Report has some restrictions. First, a list range (a list) can be sorted only on three columns maximum. This is the restriction of the Sort method of the Range object. Second, XL Report can sort a list range only in left-to-right order. If you set Sort option for more then three columns then only the three leftmost columns will be used for sorting. Totals in a columnWhere? QDemo.dpr form: frmLists2; unit: fLists2; template: tLists2.xls In the previous chapter, we showed you how to get a sum of column values in a list range. The formula generated by XL Report for the column was =SUBTOTAL(9;:, where 9 stands for Sum (See Excel Help if you need assistance). XL Report supports all the summary functions of SUBTOTAL. Here are the respective options:
![]() You can get only one summary option for a column. If you provide several options (separated by a semicolon, of course), then XL Report will use only the last one. We warned you that in the case of summary option the option row isn't destroyed. Notice the Total string in the I13 cell of the template. Its contents confirm our statement that the option row will be deleted. This is the one and only exception. Subtotals in a list rangeWhere? QDemo.dpr form: frmLists3; unit: fLists3; template: tLists3.xls Summary options can be used in combination with the Group option. Provide this one for columns where you want to get subtotals. Here is an example. Open the template of the previous example and write down Sum in Items Total and Amount Paid column option cells. In the option cell of the Payment Method column write down the Group option. Save, close, and run the report. You can see the result - subtotals are inserted in the Payment Method column. ![]() ![]() You can provide up to 16 columns for subtotals. Add the Group option to the Sale Date column. In the report you see that 1) subtotals are inserted on Sale Date and Payment Method; 2) the OrdersRange range contains both original data and subtotals; 3) grouping is made in left-to-right order - subtotals are calculated first on the leftmost column with Group option, then the next grouped column is on its right, and so on. This is another feature of XL Report to remember. In contrast to the total of a column, you can have several subtotals. If you add the Avg option in the Amount Paid column and run the report, you will see the sum and the average of this column. Subtotaling implies previous sorting of data (Sale Date and Payment Method columns in our case). By default, XL Report does the work itself. But if you have sorted the dataset, you can use the GroupNoSort range option. It is just a tip to lessen the time it takes to generate a report. We remind you to put range options in the leftmost bottom cell of a range. Hiding detail data in an outlineWhere? QDemo.dpr form: frmLists4; unit: fLists4; template: tLists4.xls Add the COLLAPSE parameter to the Group option in the previous example to hide detail data in a subtotaled report. It can be useful if your customer prefers to see grand totals immediately and then decipher them by using the outline symbols. ![]() XL Report uses only the rightmost option column containing the Group option with this parameter. Time to look back - list range options
|
Components
Developed forDelphi 4, 5, 6, 7 Excel version supportedMS Excel 97 (SR2)
[ Download it ] |