Grouping Options

Here's the property list for the definition of a report grouped by a single DRMasterCriteria where that master criteria is based on a single DRSubMasterCriteria:
GroupDef = (
        {
            subCriteriaList = (
                {
                    groupEdges = NO; 
                    key = category; 
                    possibleValues = (Action, Drama, Cult); 
                    possibleValuesUseType = usePredefined; 
                    useMethod = NO; 
                    useTimeFormat = NO; 
                }
            ); 
            userInfo = {
                IS_STRING = YES; 
                OTHER_LABEL = Other; 
                SHOW_OTHER = YES; 
                SHOW_TOTAL = YES; 
                TOTAL_LABEL = Total; 
                calendarFormat = "%m/%d/%Y"; 
                compoundSeparator = "|"; 
                rangeSeparator = " to "; 
            }; 
        }
Here is a WRReportEditor component that graphically edits the above model definition. Note that the DynaReporterJavaApp example shows how one can store and open DRReportModel definitions on the fly from the file system.

CustomAs you can see there are Add buttons to add multiple master criteria as well as multiple DRSubMasterCriteria. In the case above we begin with one master criteria defined with a single sub master criteria.The DRSubMasterCriteria's chief attribute is the 'key' which here is a 'category'. This can also be a key path. If you want the DRGrouping kit to treat the key as method, check the 'Mthd?' checkbox. If you want the kit to treat the value of the key as a date or time, then check 'Time?' and enter a 'Format' for what kind of period you wish to group by. (The string for the Format is any valid NSCalendarDate/NSGregorianDate format string). For example, if you were grouping Movies by their 'dateReleased' (entered for the 'key') and you were interested in grouping by Years, then you would check 'Time?' and you would enter '%Y' as the Format. If you also wanted to group by Month, you might add another DRMasterCriteria and enter everything the same as for the year except set the Format for this item to '%m'. Thus for dates you can group objects by the exact same attribute n-times with different date formats. This allows you to create multi-dimensional reports where you might break objects down by Year, and each year into Months.

If you want to force DRGrouping to treat the value as String even if it returns a number, then check the 'Is a String?' check box.

Normally you want the DRGrouping kit to add groups dynamically as they are discovered in the grouping process. For this behavior select NONE as the 'Pre-defs Type'. If you wish to only group by specific pre-defined possible values, then select 'usePredefined' in this popup (as it is by default in this example), and enter in the list of possible values you desire in the 'Possible Values' text box. This value needs to be in plist Array format as shown in the example. Note all objects not associated with the Possible Values are placed in a special group called the Other group.

If you wish to group objects not by their equality to a value but by their in-betweenness to end-point values, select the 'useRange' Pre-defs Type in the popup. This sort of predefined type is useful when grouping by numeric values like revenue in the Movies database. The numbers or dates that make up the Possible values in this case are treated as endpoints. Two values mean there are two groups: all objects in that range, and all objects not in that range. The objects not in the range are placed into the Other group. You can use the 'Edges?' checkbox to tell DRGrouping to add two groups to represent all objects above and below the end points of your predefined ranges of values.

If you have a regular range of values in mind and want DRGrouping to dynamically add ranges on the beginning and end of the endpoints you defined in the Possible Values, select 'usePeriodic' as your Pre-defs Type. One use fot the usePeriodic is the case of grouping by fiscal Quarter. A Quarter doesn't just fall into the date format capabilities of NSGregorianDate. So to pull this off you could define a period of 3 months for the Possible Values and DRGrouping would create groups for all the 3 month periods it finds after or before the period you define.


Note that the bindings for a WRReportEditor component are few and simple:

attributeList is an array of DRAttributes to edit

attributeUpdateAction is a string naming a action you want to fire in your page whenever a user clicks the update attributes button (not shown in the above example as only the grouping criteria are being edited)

masterCriteriaList is an array of DRMasterCriteria to edit

masterCriteriaUpdateAction is the same as attributeUpdateAction but for when the user clicks the Update Grouping Criteria button.

showAttributeEditor a string that can be "NO" to hide the DRAttribute editor.