Home > Support > Resource Center > askSam 4 Documentation > Chapt11: Grouping Fields

First Document Previous Document Next Document Last Document Search Help

     Chapter 11     

     (continued)     

     The askSam Report Writer     


Grouping Fields

In many reports you will want to do more than sort and output lists of fields. You may want to group your Documents. Grouping organizes and arranges documents providing you with an overview of your information. You can calculate totals and count a grouped field.

The following shows you a report where the SALES REP field is grouped:




You can group a report on any field you sort, and multiple grouping levels are permitted. When you group on more than one field, the groups are organized according to level. The first field you sort and group is the most major to be sorted; the second field is sorted within the first group; etc.

In askSam you can use the group function to create subtotals or to summarize your information. This section will discuss the various uses of the group function. These examples use data and reports that are in a file called SAMPLE_REPORTS.ASK that is included with askSam.


To Group and Subtotal a Field:

This example will create a report grouped on Sales Agent, with the Sales Agent's name, the names of the agent's clients, and the sale amount totaled.


1.     Choose TOOLS -> REPORTS.

The Report Manager Dialog Box will appear.

2.     Enter a name for the report and choose OK.

A new report is created and you are in the Report Editor.

3.     Choose REPORT -> SORTING AND GROUPING.

The Sorting and Grouping Dialog Box will appear. Sort on the field (or fields) that you will group. Make sure you set the “Group Field” option to Yes for each field you want grouped.

In this example, only the AGENT[ field will be grouped. Define the sort on the Last Word in the AGENT[ field, and set the “Group Field” option to Yes. Then define a sort on the Last Word in the NAME[ field, and choose OK.


4.     Define the layout for the report by placing the fields in your report.

In this example, place the AGENT, NAME, and $ fields in the report. To have the $ field properly aligned, set it on a decimal tab.


5.     Click on the button after the $ field.

The Insert Field Dialog Box will appear.

6.     Choose the “Total Field” option to total the $ field.

7.     Choose OK to close the Insert Field Dialog Box.

Your Report Layout should now look like this:



This example outputs the following list:




NOTE: The SAMPLE_REPORTS.ASK file contains example reports using the Group command.


The Sorting and Grouping Dialog

The Sorting and Grouping Dialog Box lets you define how your report will be sorted and grouped.



The Sorting and Group Dialog contains the following items:

FIELD  Let's you enter or select a field name to sort and group.


TYPE  Defines the field type. Choose from:


     SORT TYPE     DESCRIPTION

     TEXT     Sorts in alphanumeric order.

     DATE     Sorts by date

     NUMERIC     Sorts numerically


ORDER  Determines whether the sort will be in ascending or descending order.


SORT ON  Determines whether to sort on: the entire field, the last word in the field, the first word in the field, the first word in the Document, or the first line in the Document.


SORT/GROUP MODIFIERS  Set the following modifiers:

MODIFIER      DESCRIPTION

IGNORE CASE     When turned on, sorting and grouping ignore case.


IGNORE ARTICLES     When turned on, sorting and grouping ignore the articles “A”,           “An”, and “The”.      


     GROUP FIELD     Set to yes to group a field.


     # OF CHARACTERS GROUP     Defines the number of characters to group and output in your

     GROUP     report. The default value is 30. It is only necessary to change           this setting if you want to output more than 30 characters, or if           you only want to output the first "n" characters of the grouped           field.


Group Footers

A Group Footer allows you to add text to totals and subtotals from the TOTAL and COUNT Commands. It also acts as a separator between the groups in a report.

To insert a Group Footer, you choose the REPORT / GROUP FOOTER command in the REPORT menu.


Adding a Group Footer to the Previous Report:

1.     Choose TOOLS -> REPORTS and choose the report you created in the last

section.

2.     Choose the EDIT button.

The report will appear.


3.     Choose REPORT -> REPORT / GROUP FOOTER.

The Group Selection Dialog Box will appear.


The Group Selection Dialog Box displays any Group Footer levels that are available and also lets you turn on the Report Footer. The Report Footer displays at the end of your report.

4.     Select Group Footer 1 and Report Footer. Then choose OK.

The Group Footer and Report Footer windows will open.

5.     In the Group Footer window, enter text and/or the Count command.

For example: Place the text “Subtotal” in the Group Footer window.

6.     In the Report Footer window, enter text and/or the Count command.

For example: Place the text “Total” in the Report Footer window.


The layout of our sample report would look like this:



When the report is run, it outputs:



NOTES:

1.     If you wish to insert blank lines between your Groups, simply insert a blank line in your a Group Footer.

2.     The SAMPLE_REPORTS.ASK file contains example reports using the Group command with Group Footers. The examples include reports that contain multiple level Group Footers.

Counting In Groups

The Count Documents command can be used to count the number of Documents selected in each group. By inserting the Count Document command in any Group Footer or the Report Footer, the number of Documents in each group and the total number of Documents in the report will be output.


To Insert the Count Documents Command:

1.     Position the cursor in the Group Footer where you want the Count inserted.

2.     Choose REPORT -> COUNT DOCUMENTS.

The Count Documents command will be inserted. This command is described earlier in this chapter.


     Example:




This would output the following report:



NOTE: The SAMPLE_REPORTS.ASK file contains example reports using the Group and Count commands.



Using the Count Documents Command for a Summary

You can use the Count Documents command to get a summary of your information. For example, perhaps you want a breakdown of how many accounts are located in what states along with the total number of accounts. To accomplish this:


1.     Create a new report.

2.     Sort your Documents on the STATE field. Define this field as a “group” field in the Sort dialog.

3.     Insert the STATE field in the Report Editor.

4.     Place the Count Documents command several spaces after the STATE field.


The report will look similar to the following screen:



This report will output the following list:


NOTE: The SAMPLE_REPORTS.ASK file contains example reports using the Group and Count commands. The “Group  Summary Report of Countries” report demonstrates how the Count Documents command can be used to create a summary report.


Headers And Footers In Reports

There are several different Headers and Footers that you can include in reports.


HEADER/FOOTER     DESCRIPTION


PAGE HEADER/FOOTER     Contains information that displays on the top or bottom of      every page. They are used to include titles, column headings,      page numbers, dates or any other information you want to      repeat on every page. You can turn page headers/footer on      and off by choosing VIEW -> PAGE HEADER or VIEW ->

     PAGE FOOTER.


REPORT HEADER     Contains information you want output at the beginning of      your report. For example: the report title and column headings.      You can turn the Report Header on and off by choosing      REPORT -> REPORT HEADER.     


GROUP FOOTER     Group Footers are displayed between groups in your report.      They are used to label subtotals, the Count command, and to      separate groups. You can turn Group Footers on and off by      choosing REPORT -> REPORT/GROUP FOOTER.


REPORT FOOTER     Contains information you want output at the end of your      report. The Report Footer is normally used to label totals, the      Count Command, and add other text to the end of a report.      You can turn the Report Footer on and off by choosing      REPORT -> REPORT/GROUP FOOTER.


The following commands are useful in Page Header/Footers and Report Headers/Footer. Some of these command need to be typed into the header/footer. Others are inserted using the menus.

COMMAND     HEADER / FOOTER FUNCTION


EDIT -> INSERT ->      Inserts the current date when the report is run. You can also

DATE HOTFIELD     insert this command by entering ^D.


EDIT -> INSERT ->      Inserts the current time when the report is run. You can also

TIME HOTFIELD     insert this command by entering ^T.


EDIT -> INSERT ->      Inserts the weekday when the report is run. You can also

WEEKDAY HOTFIELD      insert this command by entering ^W.


EDIT -> INSERT ->      Inserts the page number.

PAGE NUMBER


EDIT -> INSERT ->      Inserts Total Number of Pages in your report.

NUMBER OF PAGES


EDIT -> INSERT ->      Inserts the name of your askSam File. You can also insert this

FILE NAME HOTFIELD      command by entering ^f.


EDIT -> INSERT ->      Inserts the name and path of your askSam File. You can also

FILE + PATH HOTFIELD      insert this command by entering ^F.


NOTES:

1.     The SAMPLE_REPORTS.ASK file contains example reports using Headers and Footers.

A sample report with a Header and Footer:


When this report is printed, the page header will print a page number at the top of each page. The page footer will place the date and time at the bottom of each page.


Quick Downloads

 

How people use askSam

 

Surf Report Newsletter

Subscribe today to receive our FREE monthly newsletter. The Surf Report includes tips, articles, and information about new releases, upgrades, free utilities, and special promotions. Sign up today!


Read Back Issues »
 

"askSam is an essential part of my software tool chest. I can research and collect data from anywhere and any source. Once it is in askSam I can edit, rearrange, organize, and search the information easily. Then I can present it and make it totally useful for other people via the web or CD. Fantastic!"

-- Valda Hilley, Author, Literary Agent, Teaching Consultant, Pack rat, and President, Convergent Press, Ltd.

 

Seaside Software Inc. DBA askSam Systems, 121 S Jefferson Street, Perry FL 32347
Telephone: 800-800-1997 / 850-584-6590   •   Email: info@askSam.com   •   Support: http://www.askSam.com/central.asp
© Copyright 1985-2012   •   Privacy Statement