QM (or probably any flavor) Correlative to SORT BY just the end of an item id

65 views
Skip to first unread message

Jay Alosa

unread,
Mar 13, 2018, 9:49:24 PM3/13/18
to Pick and MultiValue Databases
Hi Group:

I'm trying to create a correlative to not just return the last six characters of an item id, I need to able to sort on it. Masks/conversion codes/format specifications have been failing me thus far. I can get query results to display just the last 6, but I can't get them to sort by that. It's always sorting on the entire item ID. I'm sure this is doable and probably a rookie question - it's just been so long since I've been intimate with dict items and I'm relatively new to QM.

Thanks very much




Zumasys Reply

unread,
Mar 14, 2018, 1:16:01 AM3/14/18
to Pick and MultiValue Databases
While it help to see the dictionary in question my guess would be you're using attribute 7 instead of attribute 8.

Mvreply

unread,
Mar 14, 2018, 6:06:01 AM3/14/18
to mvd...@googlegroups.com

0001: I

0002: @ID[LEN(@ID)-5,6]

0003:

0004:

0005: 10L

0006: S

 

Daniel Klein

--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms

Martin Phillips

unread,
Mar 14, 2018, 6:15:32 AM3/14/18
to mvd...@googlegroups.com

Or use trailing substring extraction…

 

0001: I

0002: @ID[6]

0003:

0004:

0005: 10L

0006: S

 

 

Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
+44 (0)1604-709200

John Stokka

unread,
Mar 14, 2018, 7:18:57 AM3/14/18
to mvd...@googlegroups.com
A;0[(0(L))-"5","6"]

--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+unsubscribe@googlegroups.com

John Stokka

unread,
Mar 14, 2018, 7:21:28 AM3/14/18
to mvd...@googlegroups.com
The entire dict item would look like this...

001 S
002 0
003 last6
004
005
006
007
008 A;0[(0(L))-"5","6"]
009 L
010 6

On Tue, Mar 13, 2018 at 8:49 PM, Jay Alosa <jaya...@gmail.com> wrote:

Jay Alosa

unread,
Mar 14, 2018, 10:16:10 AM3/14/18
to Pick and MultiValue Databases
Wow you guys are awesome. Thanks so much!

Mvreply

unread,
Mar 14, 2018, 10:19:32 AM3/14/18
to mvd...@googlegroups.com

It figures that Martin would have the best answer!

 

Daniel Klein

 

From: mvd...@googlegroups.com [mailto:mvd...@googlegroups.com] On Behalf Of Jay Alosa
Sent: Wednesday, March 14, 2018 10:16 AM
To: Pick and MultiValue Databases <mvd...@googlegroups.com>

--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com

To unsubscribe, email to: mvdbms+un...@googlegroups.com

Bob Dubery

unread,
Mar 14, 2018, 11:32:56 AM3/14/18
to Pick and MultiValue Databases
I don't work with QM. I checked some documents on the Zumasys site, and those docs say that QM allows Prime/Universe style I type dict items.

That being the case, the problem is easily solved.

I tried this
>ED DICT PrmMain Last6
This Type "I" Descriptor must be compiled before use.
6 lines long.

----: p
0001: I
0002: @ID[6]
0003:
0004: Last6
0005: 6R
0006: S
Bottom at line 6.
----:

Line 2 specifies the extraction of the 6 right most characters from the record key.

You should check the QM documentation to see if I-TYpes need compiling and how that is done.

Mvreply

unread,
Mar 14, 2018, 11:40:07 AM3/14/18
to mvd...@googlegroups.com

The QM documentation also states that I-types are automatically compiled when used with the query processor.

 

Daniel Klein

 

From: mvd...@googlegroups.com [mailto:mvd...@googlegroups.com] On Behalf Of Bob Dubery
Sent: Wednesday, March 14, 2018 2:47 AM
To: Pick and MultiValue Databases <mvd...@googlegroups.com>
Subject: [mvdbms] Re: QM (or probably any flavor) Correlative to SORT BY just the end of an item id

 

I don't work with QM. I checked some documents on the Zumasys site, and those docs say that QM allows Prime/Universe style I type dict items.

Martin Phillips

unread,
Mar 14, 2018, 11:43:13 AM3/14/18
to mvd...@googlegroups.com

Ø  You should check the QM documentation to see if I-Types need compiling and how that is done.

An I-type is automatically compiled when first used in a query. No special action is needed.

 

Note that in QM, correlatives are also compiled for improved performance though we strongly recommend use of I-types instead as they are much more powerful and usually easier to understand.

 

 

Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
+44 (0)1604-709200

 

 

 

From: mvd...@googlegroups.com [mailto:mvd...@googlegroups.com] On Behalf Of Bob Dubery
Sent: 14 March 2018 06:47
To: Pick and MultiValue Databases
Subject: [mvdbms] Re: QM (or probably any flavor) Correlative to SORT BY just the end of an item id

 

I don't work with QM. I checked some documents on the Zumasys site, and those docs say that QM allows Prime/Universe style I type dict items.

Tony Gravagno

unread,
Mar 14, 2018, 1:13:28 PM3/14/18
to Pick and MultiValue Databases
For anyone who wants to do this with a Pick-style dictionary:
The a7 Conversion is not used for selecting or sorting.
A7 converts query text into internal format.
A8 then processes the data, does selecting, and sorting
A7 then converts the final data into external format.

Example: With a7=D2/ you can enter a date in any format at TCL, it does the selection and sorting on internally formatted dates, and then it outputs the externally formatted date. In this specific case, A7 only cares that it's a D code, the 2/ is only used in the final formatting.

Think of A8 for selecting and sorting and A7 for rendering after that/

So for Jay, the text extraction needs to be in A8:

1 A
2 0
7
8 T6
9 R
10 6

(I hope QM still works like this too...) The T-text substring operation defaults to starting at the side directed by the Justification.
If that T6 is in A7, then the select/sort is done using what's in A8, which is an unmodified key, and then the output gets the T6 applied.

More details in my blog:How Pick Dictionary Items Work

HTH
T
Reply all
Reply to author
Forward
0 new messages