Report Writer Pro – Pro!

Order Icon Alpha Order Icon

Section or Sort – What’s the difference?

Should you section or sort your report?  The answer is that it depends on how you want your report to look.  In Report Writer Pro you have the option to sort or section the data displayed on the report, but what’s the difference?  You have the same Available Columns to choose from and the same Order selection (i.e. Asc, Desc, or Default), but the main difference is that when using Sections, you can add Sub headers and Subtotals to the report.  In short, Sections are a more advanced and robust form of Sorting.

When running a report, all information is loaded into lists.  The lists are then read through from beginning to end and the report decides what needs to be done with each line item as it is being read.  This means that for the report to display like information together, it needs to be grouped together in the list and this is where the sort comes into play.  Before reading the list, we tell the report to sort the line items by a key resulting in the line items being in the order needed.  So, if we are going to have sections, the report needs to sort by that section key to group it together in the list.

Ascending, Descending or Default

One thing to note is that the system always sorts in Ascending order.  With numerical values, it appears to sort descending because the report can subtract the value from zero making the smallest number be the greatest and vice versa and use the result as the key on which to sort.  However, there isn’t a ‘zero’ to use in Alpha character sorts which is why this is not an option with items such as Security Names and Portfolio Codes.  Then what is the default and why isn’t this always available?

The “Default” option appears for items in your system that have a sort order already established somewhere else.  For example:  when sorting on the security type, you have the option of Ascending or Default.  Ascending will display the data in alphabetical order based on the four character code of the security type.  The default option will display the information based on the order of your security types in your security type file.  If you have ‘csus’ before ‘caus’ in the security type file, you will be able to see Common Stock before Cash even though ‘ca’ comes before ‘cs’.

Order in the Sort!

Sometimes you will find that you will not have a column available to use in your sort or section.  If you use a column in the sort, you will not be able to use it in the section and vice versa.  When adding sections and sorts, RPW will show you the priority of the sort based on indentation.






With this sort, the report will group all information for a Portfolio together, then within that data it will group the same trade dates together, within the trade dates it will group trade amounts and then within the trade amounts it will display in ascending alpha order of the security descriptions.  Between the sorting and sections, the report will use the Section as the top of the hierarchy or the main grouping and the sort is the sub-grouping.  In the above example, if you needed this order, but didn’t want to have subtotals or sub headers for the Trade_Amount and Security_Name, you would add the Portfolio_Code and Trade_Date to the Sections and the Trade_Amount and Security_Name to the sort.

But what if you didn’t want to have sub headers and totals by portfolio?  If you move Portfolio_Code to the sort, then the Trade_Date becomes your main sort, so instead you can just remove all text related to the Sub header and Subtotal lines.  Clearing these will keep Portfolio_Code as your primary grouping without the extras.  Although you could keep the Trade_Amount and Security_Name as part of the section and remove all the text and printing options for the Section header and subtotals as well, it is easier to add them to the sort since they are subgroupings anyway.

In conclusion, just keep in mind that if you sector, you sort and if you sort, you don’t sector. You need to ask yourself, to sector or not to sector?  That is the question.