Download A4 - Rush Flat Consulting

Transcript
Introduction to QMQuery and QM Dictionaries
Operator
EQ
NE
LT
LE
GT
GE
LIKE
UNLIKE
SAID
NO
BETWEEN
Synonym
=
#
<
<=
>
>=
MATCHES
NOT.MATCHING
SPOKEN
Synonym
EQUAL
NOT
LESS
=<
GREATER
=>
MATCHING
Page 61
Synonym
Synonym
<>
BEFORE
><
AFTER
~
Note that some operators have multiple synonyms. OpenQM does not care which
synonym you use – it offers you a choice for your convenience.
5.3.1
Creating a dictionary item for use in selecting data
Say we want to display the exchange rates for the year 2013. We could write a QMQuery
statement like:
SORT XRATES WITH YEAR EQ 2013
Traditionally, multi-value databases have required that the comparison value in the
expression be enclosed in quotes. So, in other databases, we would need to write:
SORT XRATES WITH YEAR EQ “2013”
OpenQM makes these quotes optional. You can choose to include them or omit as you
please. But if you are going to use one of the other multi-value databases, it would be
good practice to quote your comparison values.
Running this commad, OpenQM responds with:
YEAR is not a field name or expression
This means that OpenQM has not been able to find a definition of the word YEAR – it does
not appear in either the file dictionary or the VOC of the account. Therefore, we need to
define the word YEAR so that QMQuery understands what we mean.
To define YEAR, we use the MODIFY editor.
MODIFY DICT XRATES
Type in
ID
YEAR
YEAR
Type
I
at the ID prompt, and define the item as follows:
Loc
OCONV(@ID, ‘DY’)
Conv
Name
Year
Once you have filed the item, exit from the
statement:
Format
4R
MODIFY
S/M
S
Assoc
editor and retry the QMQuery
SORT XRATES WITH YEAR EQ "2013"
XRATES....
16440
16441
16444
16445
Let’s add the date so that we can see if we really have 2013 information:
SORT XRATES WITH YEAR EQ "2013" DATE
XRATES....
Date........
16440
03 JAN 2013
16441
04 JAN 2013
16444
07 JAN 2013
16445
08 JAN 2013
That looks good. Let’s see how we did that:
In the ‘Type’ field, we entered ‘I’. ‘I’ stands for indirect, and it means that this is a
calculated field. In OpenQM jargon, this type of dictionary item is known as an I-type.
© Rush Flat Consulting
Getting Started in OpenQM - Part 1