|
[Home |
Announcements |
Access |
Installation |
User Notes |
Data Dictionary |
Mailing List |
Contact]
U s e r N o t e s
Advanced GQL Features
This write-up contains explanations and procedures for performing advanced GQL operations.
The steps outlined here apply to both Macintosh and Windows users.
These are advanced features, and some of them are complex. You can go through this list and
try various features, or you can wait until you want to do something difficult, and see if there
is a procedure here for doing it.
Contents
It is possible to look up data in other objects while qualifying queries. This includes
the validation tables, and the data found can be inserted automatically into the qualification.
For example, you may want to qualify a query based on Course Level. You can start your
query, then use this feature to look up the values for Course Level from the Level
validation table.
- Open an object to start a query by double-clicking on it.
- Start a qualification by clicking the Qualify box next to an attribute (e.g.
Course Level).
- From the Edit menu select Insert Data Values.
- Select the object you are interested in by clicking on it in the Table Names
list (e.g. Level).
- Select the attribute you are interested in by clicking on it in the Attribute Names
list (e.g. Level Code).
- Click the Load Data button.
- The data will appear in the Data Values window.
- To insert one of the values into the qualification, click on it and click the Insert button.
A prompt is a feature which allows you to automatically qualify a query with different values
each time you run it. The prompt will display a message such as "Enter Student ID:" and
allow you to type in a Student ID. The query will then use the value you enter as a qualification.
- Open an object to start a query by double-clicking on it.
- Start a qualification by clicking the Qualify box next to an attribute.
- Select Insert Prompt from the Edit menu.
- Click the New button.
- In the Prompt ID field give this prompt a name (e.g. "Student ID Prompt").
- In the Prompt String field, enter the text which will be displayed to ask for a value
(e.g. "Enter a Student ID:") and click OK.
- Click on the name of the prompt you just created in the Prompt Ids list.
- Click Insert Prompt.
- The prompt name will appear in the Qualification field (e.g. "<<Student ID
Prompt>>").
- When you submit the query, you will prompted for a value.
- You can reuse this prompt in other queries by selecting it in the Insert Prompt window.
Sometimes a value you need to qualify a query must be created using another query (e.g. finding
all students with a GPA >= the average GPA). This value can be derived using a subquery
(in this case, finding average GPA is the subquery).
- Create the subquery, you don't need to run it (e.g. select Accum UO GPA in the Summary
Object and select Average Distinct from the Function box).
- Select Save Query from the Query menu.
- Type a descriptive name for the query in the Query Name field.
- Click Save.
- Select New Query from the Query menu.
- Create your query (e.g. select Student ID from Person).
- Qualify an attribute by clicking the Qualify box (e.g. Accum UO GPA >=).
- Select Insert Subquery from the Edit menu.
- In the Saved Queries list, select the subquery that you created above.
- The query name will appear in the qualification box.
- Run the query.
You may qualify an attribute by comparing it to the value of another attribute (e.g. to select
students who have earned all of the UO hours that they have attempted).
- Open an object to start a query by double-clicking on it.
- Start a qualification by clicking the Qualify box next to an attribute.
- Select Insert DB Name from the Edit menu.
- Select the name of the data object from the Data Objects list. You must
select the data object you are qualifying.
- Select the attribute you want to use for qualification from the Attribute Names list.
- Click Insert Name.
- The attribute name will appear in the qualification box.
- Run the query.
You can change the order of columns in a query in several ways.
- Before you submit a query, select Column Order from the Query menu.
- After you submit a query, select Reorder Columns from the Results menu.
- In a GQL Standard Report, select Reorder Columns from the Report menu.
After selecting one of these options, you will see the Column Order window.
- In the Ordered Columns list, click on a column.
- The First, Last, Up and Down buttons
move that column to the indicated place.
- Highlighted columns can be moved to the Unordered Columns list by clicking
the << Move << button.
- Columns in the Unordered Column list are randomly ordered by GQL.
Before you execute a query,
you can change the sort order, which determines which columns
are sorted first, second, etc., and also whether columns are sorted
ascending or descending.
- Before you submit a query, select Sort Order from the Query menu.
- In the Sort Order window, if the Sort Order list is empty, then nothing
is being sorted.
- To sort on a Selected Column, select the column in the Selected Column
list and click >>Move>> to move it to
the Sort Order list.
- To remove a column
from the Sort Order list, select it and click the <<Move<< button.
- To move a column in the Sort Order list, click on it, then click First,
Last, Up or Down. These buttons move the column to the indicated place.
- When a column is highlighted in the Sort Order list, click Ascending
to sort it in ascending order, or Descending to sort it in descending order.
It is possible to add computed
attributes to your queries. A computed attribute is an attribute
that is not part of the original Student Data Warehouse objects,
but instead is derived by combining data in other attributes or
using special functions to get new data.
For example, you could
use a computed attribute to add SAT scores and display their sum
in a query. There are many math, date, and character functions
you can use to create computed attributes. This is a complex
feature of GQL; if you decide to use it, refer to the GQL User
Manual, page 107, Computed Attributes.
You may want to qualify
an attribute that is a group attribute, such as a count or a sum.
For example, you may want to select all courses which have fewer
than 5 students enrolled. To count students enrolled in courses,
you need to use COUNT DISTINCT in the Registration object.
But GQL does not allow you to qualify an attribute if it is a
group attribute. So, follow these steps to qualify a group attribute:
- Start a query, selecting at least one group attribute.
- Select Group Qualification from the Query menu.
- In the Columns list, select the group qualification you are interested in.
- Click Move, which moves the qualification to the bottom window.
- In the bottom window, type in the qualification you want to use, such as <5.
- You may also use prompts and database names here.
- When you submit the query, the group qualification will be used to select data.
Negating a qualification
means only returning data that do not meet the given qualification.
To return all data that do not contain a certain value, qualify
for that value and then negate the qualification. For example,
to return students who are not undergraduate students,
qualify Level = UG, then negate the qualification.
- Start a query, and qualify an attribute.
- Above the attribute name in the qualification, click on the rectangular box.
- The box will darken, indicating that you selected it.
- Select Negate Clause from the Query menu.
You may have as many qualifications
in a query as you like.
Sometimes you may need to group (or combine)
qualifications to get the results you want. If you need to do
this, follow these steps:
- Create at least 3 qualifications, if you have two or less, there is no need to group them.
- Decide which qualifications you wish to group together - you can group 2 or more.
- Above each of these qualifications, click the rectangular box while holding down the
shift key.
- The boxes you click will darken, indicating that you selected them.
- Select Combine from the Query menu.
- GQL will graphically combine the qualifications and use them when you submit the query.
Once you have combined
qualifications, you may want to Uncombine them:
- When you have combined qualifications, they will be next to each other, with a vertical
line above the connective (and or or) leading to a rectangular box.
- Click the single rectangular box above the connective (and or or).
- Do not click the boxes above the individual qualifications.
- Select Uncombine from the Query menu.
After a query has been
submitted and results returned, you may re-sort the values without
having to run the query again. This may be useful for queries
that take a long time to run.
- Start with a Query Results window.
- After the results are returned, select Filter Results from the Results menu.
- From the Selected Columns list, move columns to the Sort Order
list by clicking on them and clicking the >>Move>> button.
- Columns will be sorted in the order they are listed in the Sort Order list,
from top to bottom.
- Select columns in the Sort Order list to reorder them, and remove them.
After a query has been
submitted and results returned, you may restrict the selection
of any attributes in the query, possibly reducing the number of
rows in the query results.
This may be useful to avoid re-submitting a query that takes a long time to
return results.
- Start with a Query Results window.
- After the results are returned, select Filter Results from the Results menu.
- From the Columns list, select a column by clicking on it.
- Enter a Minimum and/or Maximum value in the fields provided.
- If you want data that falls outside the given range, click Not in range.
You may run a query more
than once with different qualifications and then combine the results
to get a single set of query results that you may display as a
report, etc.
The query results that you combine must have the same attributes displayed.
- Submit the query twice, using different qualifications so that you get different query results.
- Do not delete either of the query results windows.
- Select Combine Results from the Results menu.
- Select Append Columns.
- The names of the two results you want to combine will be showing in the Append Rows window.
- Click OK.
There are two basic methods
for exporting query results to other applications, such as Microsoft Word or Microsoft Excel.
The first method is to copy and paste the results yourself.
The second method is to create a button in GQL that automatically
exports a query to another application. This second method is
a bit more complicated but worth it if you do this frequently.
Method I - Cut and Paste
- Create and submit a query.
- Select Select All from the Edit menu.
- Select Copy from the Edit menu.
- Start the application you wish to export to, such as Word or Excel.
- Click on the place in that application where you want the query results to go.
- Select Paste from the Edit menu.
Method II - Create a Button
- Select New Query from the Query menu.
- Select Create Button
from the Layout menu.
- Click Edit Text to change the text that will appear on the button, then OK.
- For Linkage select Query.
- For Output select Application.
- Click Results Options and make sure that the Record item in
the Separator area is <CR><LF>.
- Click Export Options.
- From the Application list, choose the application you are interested in.
- Click OK, then OK again.
- You will now see your new button on the GQL Model. Use the hand to drag it to the place you want.
- Select Edit Mode from the Layout menu.
- You are now ready to use the button.
- Create a query, but do not submit it.
- Click the button you created, and the query will be exported to the application.
If you have problems with
method II, don't panic. You can change the settings for the button
which are usually the problem.
- Select Edit Mode from the Layout menu.
- Double click on the button you created.
- Click on Export Options.
- Check the settings there, especially the Execute Command Line.
This page was last updated on February 27, 1997.
[Home |
Announcements |
Access |
Installation |
User Notes |
Data Dictionary |
Mailing List |
Contact]
|