INTOUCH®
Guided Query Language


Previous Contents Index

2.4 Sorting Fields

We want the report to list the client information in alphabetical order by last name. The next step is to sort the records.

GQL prompts us to select the SORT option.



+--------------------------------Guide Options---------------------------------+ 
|  TITLE    OPEN    RELATE    SELECT    SORT    PRINT    GO    EDIT    MORE  >>| 
+------------------------------------------------------------------------------+ 

Select the SORT option.

The Sort Options and the CLIENT record fields are displayed.

Example 2-6 Sort Options and Fields Menu


+-Sort Options--+--------------CLIENT Fields---------------+ 
|  FIELDS     [>|  AGE        |   CONTACT   |   PHONE      | 
|  ASCENDING    |  BALANCE    |   FIRST     |   SALESMAN   | 
|  DESCENDING   |  BDAY       |   ID        |   STATE      | 
|  command      |  BUSINESS   |   LAST      |   STREET     | 
|  done         |  CITY       |   MIDDLE    |   WEIGHT     | 
+---------------|  COMMENT    |   MOTHER    |   ZIP        | 
                +------------------------------------------+ 

GQL prompts us to select the FIELDS option.

Select the FIELDS option.

Use the arrow keys to select the LAST name field.



+-Sort Options--+--------------CLIENT Fields---------------+ 
|  FIELDS     [>|  AGE        |   CONTACT   |   PHONE      | 
|  ASCENDING    |  BALANCE    |   FIRST     |   SALESMAN   | 
|  DESCENDING   |  BDAY       |   ID        |   STATE      | 
|  command      |  BUSINESS   |   LAST      |   STREET     | 
|  done         |  CITY       |   MIDDLE    |   WEIGHT     | 
+---------------|  COMMENT    |   MOTHER    |   ZIP        | 
                +------------------------------------------+ 

The Sort Options menu is displayed.

We want to list the last names in ascending order.

Use the arrow keys to select the ASCENDING sort option.

Example 2-7 Sort Options Menu


    +-Sort Options--+ 
    |  FIELDS     [>| 
    |  ASCENDING    | 
    |  DESCENDING   | 
    |  command      | 
    |  done         | 
    +---------------+ 

We have completed creating the GQL command which will: sort the last names in ascending order. The actual command is displayed at the bottom of the screen.


        Guide_sort>  SORT CLIENT(LAST) ASCENDING

GQL prompts with the FIELDS option. If there were other fields to be sorted, the preceding sort steps would be repeated for each field to be sorted.



+-Sort Options--+--------------CLIENT Fields---------------+ 
|  FIELDS     [>|  AGE        |   CONTACT   |   PHONE      | 
|  ASCENDING    |  BALANCE    |   FIRST     |   SALESMAN   | 
|  DESCENDING   |  BDAY       |   ID        |   STATE      | 
|  command      |  BUSINESS   |   LAST      |   STREET     | 
|  done         |  CITY       |   MIDDLE    |   WEIGHT     | 
+---------------|  COMMENT    |   MOTHER    |   ZIP        | 
                +------------------------------------------+ 

Use the arrow keys to select the done option because we are done telling GQL what fields to sort.



+-Sort Options--+--------------CLIENT Fields---------------+ 
|  FIELDS     [>|  AGE        |   CONTACT   |   PHONE      | 
|  ASCENDING    |  BALANCE    |   FIRST     |   SALESMAN   | 
|  DESCENDING   |  BDAY       |   ID        |   STATE      | 
|  command      |  BUSINESS   |   LAST      |   STREET     | 
|  done         |  CITY       |   MIDDLE    |   WEIGHT     | 
+---------------|  COMMENT    |   MOTHER    |   ZIP        | 
                +------------------------------------------+ 

2.5 Fields to Print on the Report

We have selected the records to be included on the report and how they are to be sorted. Now we have to select the fields we want to have printed on the report.

For this sample report, we will print the ID, last name, first name and city.

GQL prompts us to select the PRINT option.



+--------------------------------Guide Options---------------------------------+ 
|  TITLE    OPEN    RELATE    SELECT    SORT    PRINT    GO    EDIT    MORE  >>| 
+------------------------------------------------------------------------------+ 

Select the PRINT option.

The Print menu and the CLIENT fields are displayed.

Example 2-8 Print Menu


+----------------------------------Print Menu----------------------------------+ 
|  FIELDS    VARIABLES    item_done    done    OPTIONS    command              | 
++--------------CLIENT Fields---------------+----------------------------------+ 
 |  AGE        |   CONTACT   |   PHONE      | 
 |  BALANCE    |   FIRST     |   SALESMAN   | 
 |  BDAY       |   ID        |   STATE      | 
 |  BUSINESS   |   LAST      |   STREET     | 
 |  CITY       |   MIDDLE    |   WEIGHT     | 
 |  COMMENT    |   MOTHER    |   ZIP        | 
 +------------------------------------------+ 

GQL prompts us to select the FIELDS option.

Select the FIELDS option.

The first field we want to print on the report is the ID.

Use the arrow keys to select the ID field.



+----------------------------------Print Menu----------------------------------+ 
|  FIELDS    VARIABLES    item_done    done    OPTIONS    command              | 
++--------------CLIENT Fields---------------+----------------------------------+ 
 |  AGE        |   CONTACT   |   PHONE      | 
 |  BALANCE    |   FIRST     |   SALESMAN   | 
 |  BDAY       |   ID        |   STATE      | 
 |  BUSINESS   |   LAST      |   STREET     | 
 |  CITY       |   MIDDLE    |   WEIGHT     | 
 |  COMMENT    |   MOTHER    |   ZIP        | 
 +------------------------------------------+ 

We have created the GQL command which will: print the ID on the report. The actual command is displayed at the bottom of the screen.


        Guide_list>  PRINT CLIENT(ID)

GQL prompts us to select the item_done option.



+----------------------------------Print Menu----------------------------------+ 
|  FIELDS    VARIABLES    item_done    done    OPTIONS    command              | 
+------------------------------------------------------------------------------+ 

Select the item_done option because we are done with the ID field.

GQL shows us where on the report the ID will be printed. The ID column heading and last position used are also displayed.



                                 CLIENT LIST 
                                                                        Pos:   5 
CLNT 
ID 
----- 
XXXXX 

The next field to print on the report will be the client's last name. Perform the following steps to create the GQL command to print the LAST name field on the report.

  1. Use the arrow keys to select the LAST field.
  2. Select the item_done option.

GQL shows where the last name will be printed.

Perform the following steps to create the GQL commands to print the FIRST name field and the CITY on the report.

  1. Use the arrow keys to select the FIRST field.
  2. Select the item_done option.
  3. Use the arrow keys to select the CITY field.
  4. Select the item_done option.

We are now done creating the GQL commands to list the four fields on the report and we can see what our report will look like.



                                 CLIENT LIST 
                                                                        Pos:  65 
CLNT  Last              First 
ID    Name              Name            City 
----- ----------------- --------------- ------------------------- 
XXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX 

Use the arrow keys to select the done option on the Print Menu. This will tell GQL that we are done using the Print Menu.



+----------------------------------Print Menu----------------------------------+ 
|  FIELDS    VARIABLES    item_done    done    OPTIONS    command              | 
+------------------------------------------------------------------------------+ 

The next step will be to generate the report.

2.6 Generate the Report

We are now ready to actually generate the report.

Select the GO option from the Guide Options menu and report generation will begin.



+--------------------------------Guide Options---------------------------------+ 
|  TITLE    OPEN    RELATE    SELECT    SORT    PRINT    GO    EDIT    MORE  >>| 
+------------------------------------------------------------------------------+ 

As GQL starts processing your report commands, information messages are displayed.

Building the procedure...

Processing your request...

During GQL processing, report generation statistics are displayed.

Example 2-9 Report Generation Statistics


                        +------------------------------+ 
                        |              GQL             | 
                        | Report Generation Statistics | 
                        |          CLIENT LIST         | 
                        |                              | 
                        |                              | 
                        |                              | 
                        | Records searched:        12  | 
                        | Records selected:         6  | 
                        | Records read    :         6  | 
                        | Pages printed   :         1  | 
                        | EST time to go  :            | 
                        |                              | 
                        +------------------------------+ 

After the report is completed, you are given a choice of where to print the report.


Previous Next Contents Index