Previous | Contents | Index |
To learn how to use the Guided Query Language, we will create a sample report using the menu options and items.
The sample report will list client information from the CLIENT file. The report will include clients which have an ID number greater than 80500 and the clients will be listed in alphabetical order by last name.
The following sections will explain exactly how to create the sample report.
2.1 Report Title
We will start the report by giving the report a name or title. To give
the report a title, select the TITLE option from the
Guide Options menu.
+--------------------------------Guide Options---------------------------------+ | TITLE OPEN MAKE SET SHOW EDIT MORE exit | +------------------------------------------------------------------------------+ |
The Title Options menu will be displayed.
Example 2-1 Title Options Menu |
---|
+-Title Options-+ | enter text | | { | | } | | command | | done | +---------------+ |
Select the enter text item. This will allow you to enter the report title.
You will be prompted for a title.
Guide_title> TITLE |
Type the words CLIENT LIST at the Guide_title prompt and press [RETURN]. The input title will be displayed in quotes.
Guide_title> TITLE "CLIENT LIST" |
One to nine title lines can be entered. For our sample report, we will just use one title line.
The Title Options are displayed again.
+-Title Options-+ | enter text | | { | | } | | command | | done | +---------------+ |
Select the done item because we are done with the title information.
The report title is displayed in the center of the screen.
2.2 Open the Data Structure
We need to open the data structure to get the data we want to print on
the report.
A data STRUCTURE is a tiny file which contains the name of the data file (e.g. CLIENT.DAT), the name of the definition file (e.g. CLIENT.DEF) and some information about the two files. The structure name (e.g. CLIENT.STR) is normally the same name as the data file name but it can be different.
GQL prompts us to select the OPEN option.
+--------------------------------Guide Options---------------------------------+ | TITLE OPEN MAKE SET SHOW EDIT MORE exit | +------------------------------------------------------------------------------+ |
Select the OPEN option.
The data Structures menu is displayed. The Structures menu includes a list of the data structures that you have access to.
Example 2-2 Structures Menu |
---|
+----------Structures-----------+ | CLIENT | VENDOR | | CUSTOMER | ------------| | DETAIL | command | | INVOICE | done | | PRODUCT | | | VEND | | +-------------------------------+ |
Select the CLIENT structure.
The command to open the CLIENT structure is displayed at the bottom of the screen.
Guide_open> OPEN CLIENT |
GQL displays the Open Structure Options menu and prompts for the next option.
+-Open Structure Options--+ | name | done | | datafile | | | routine | | | SYSTEMSET | | | PASSWORD | | | command | | +-------------------------+ |
Select the done item because we are done selecting structures to open.
The CLIENT structure is opened and a message displays the number of fields.
CLIENT opened...fields: 18 |
We need to select what records we want to include on the report.
For the sample report, we will include records which have an ID number greater than 80500.
GQL prompts with the SELECT option and displays the Record Selection submenu.
Example 2-3 Record Selection Submenu |
---|
+--------------------------------Guide Options---------------------------------+ | TITLE OPEN RELATE SELECT SORT PRINT GO EDIT MORE >>| +---------------------------+Record Selection+---------------------------------+ | INCLUDE | | EXCLUDE | +----------------+ |
First select the SELECT option. Then, select the INCLUDE option because we want to include records with the ID greater than 80500.
GQL displays the Include options and the fields in the CLIENT record.
Example 2-4 Include Options and Fields Menu |
---|
+-------------I+--------------CLIENT Fields---------------+ | FIELDS [>| AGE | CONTACT | PHONE | | VARIABLES [>| BALANCE | FIRST | SALESMAN | | UNIQUE | BDAY | ID | STATE | | PARTIAL | BUSINESS | LAST | STREET | | = | CITY | MIDDLE | WEIGHT | | < | COMMENT | MOTHER | ZIP | +--------------+------------------------------------------+ |
Select the FIELDS item.
Then, use the arrow keys to select the ID field.
+-------------I+--------------CLIENT Fields---------------+ | FIELDS [>| AGE | CONTACT | PHONE | | VARIABLES [>| BALANCE | FIRST | SALESMAN | | UNIQUE | BDAY | ID | STATE | | PARTIAL | BUSINESS | LAST | STREET | | = | CITY | MIDDLE | WEIGHT | | < | COMMENT | MOTHER | ZIP | +--------------+------------------------------------------+ |
The ID field that has been included is displayed at the bottom of the screen.
Guide_include> INCLUDE CLIENT(ID) |
The Include Options menu is displayed.
Example 2-5 Include Options Menu |
---|
+-------------Include Options--------------+ | FIELDS [>| <= | done | | VARIABLES [>| > | | | UNIQUE | >= | | | PARTIAL | <> | | | = | enter text | | | < | command | | +------------------------------------------+ |
We want to include IDs greater than 80500.
Use the arrow keys to select the > option.
+-------------Include Options--------------+ | FIELDS [>| <= | done | | VARIABLES [>| > | | | UNIQUE | >= | | | PARTIAL | <> | | | = | enter text | | | < | command | | +------------------------------------------+ |
GQL prompts to select the enter text option.
+-------------Include Options--------------+ | FIELDS [>| <= | done | | VARIABLES [>| > | | | UNIQUE | >= | | | PARTIAL | <> | | | = | enter text | | | < | command | | +------------------------------------------+ |
Select the enter text option.
Type 80500 at the Guide_include prompt.
Guide_include> INCLUDE CLIENT(ID) > 80500 |
We have completed creating the GQL command which will: include IDs that are greater than 80500. The actual command is displayed at the bottom of the screen.
Guide_include> INCLUDE CLIENT(ID) > "80500" |
GQL displays the next prompt.
+-------------Include Options--------------+ | FIELDS [>| <= | done | | VARIABLES [>| > | | | UNIQUE | >= | | | PARTIAL | <> | | | = | enter text | | | < | command | | +------------------------------------------+ |
Select done because we are done telling GQL what records to include on the report.
Previous | Next | Contents | Index |