list and select on controlling and dependent colums

88 views
Skip to first unread message

Albert Kallal

unread,
Aug 25, 2022, 3:01:15 AM8/25/22
to Pick and MultiValue Databases
Well, my MV skills are starting to really get rusty (approaching 10 years now).
However, every once in a while, I spool up my older copy of D3  (in fact, I think it might be older).
Anyway, I have a question, and one that I don't remember the answer (or I am just plain wrong).

When I have a simple record like this:
(one record for this question).
I have HotelName, and then two columns (mv), of Option, and Price
(controlling Option, dependent price).

so this
list MyHotels HotelName Option Price

And thus this:

Page 1 MyHotels
MyHotels.. HotelName.. Option. ... Price
1                   Super 8 Hotel Red         70
                                               Blue         80
                                               Green        70
 [405] 1 items listed out of 1 items.

Now it escapes me, but was there a way WITHOUT doing a explode on the above to query and get me the above hotel reocrd with Option = "Blue" and Price = 70
(of course that should fail).

Of course this returns the above record - expected.
list MyHotels HotelName Option Price WITH Option  = "Blue" AND WITH Price = "70"

But, how can I get the controlling + depend to work with above condition?

I realize I can do this:
list MyHotels HOtelName Option Price 
by-exp Option by-exp price 
WITH Option = "Blue" AND WITH price = "70"

But, I seem to remember there was a way to check for "Option Blue and Price 70 (without a explode).
Of course if I don't by-exp (explode), then asking for Blue and price 70 in above works - but it should not (Blue is price at 80).

Is my memory failing me? Can I query above without a explode? or did we always have to explode the above to ensure the controlling  + depending attribute "line up" and conditions between the mv columns are respected???

Regards,
Albert Kallal,
Edmonton, Alberta Canada

David Green

unread,
Aug 25, 2022, 11:04:53 AM8/25/22
to mvd...@googlegroups.com

In UniData you do this with the “WHEN” keywoard.

--
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
---
You received this message because you are subscribed to the Google Groups "Pick and MultiValue Databases" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mvdbms+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mvdbms/3ab47fff-99a9-4364-932b-7b3d90efc8ffn%40googlegroups.com.

Albert Kallal

unread,
Aug 25, 2022, 11:28:56 AM8/25/22
to Pick and MultiValue Databases
Thank you kindly,  - my older Pick version I have sitting around does not have "when".
I just could not remember if one had to always explode a controlling and dependent set to have conditions that apply to that "set" of mv fields. 

I guess the answer is that if you don't have "WHEN" support, then you have to expand/explode to have those conditions respect each other.
But then again, if you have/had to do that, then you don't really need to setup controlling and dependent columns, do you?

Again, it been about 12 years since I done this, but I seem to recall a way of doing this.
And I seem to recall such a query would not work UNLESS you setup the controlling and dependent set.
 Of course there is "print limiting" to restrict what is displayed, but 
that's not what I'm looking for.

So, for such a query, then I don't need the C & D set then do I?
And such a C & D set does not help much at all then, right?

Anyway - I guess this comes down to my memory, or lack of.

Regards,
Albert D. Kallal
Edmonton, Alberta Canada

Albert Kallal

unread,
Aug 25, 2022, 11:53:54 AM8/25/22
to Pick and MultiValue Databases
Just to save follow up? Of course C and D fields matter - especially if you going to map that table to SQL, or have a editor figure this out!

Bill H

unread,
Aug 25, 2022, 11:54:35 AM8/25/22
to Pick and MultiValue Databases
Albert:

If I'm not mistaken you need to so something like:

LIST MYHOTELS BY-EXP Option = "Blue" HotelName Option Price

I don't ever remember any other option to "BY-EXP" in native PICK.  "WHEN" works with UV/UD and others.

Bill

Albert Kallal

unread,
Aug 25, 2022, 12:11:08 PM8/25/22
to Pick and MultiValue Databases
Thanks. I perhaps should get a newer d3 or some such up and running. 
While I not in mv land right now? Well, I still often get involved in discussions about multi-value databases. And with the huge
rise in xml and now json in our industry due to web? Then the concept of controlling and dependent data is missing from those systems.
As a result, you can't query such data without the concept of controlling and dependent data. It actually a big issue.

R
Albert

chandru murthi

unread,
Aug 27, 2022, 1:27:05 PM8/27/22
to Pick and MultiValue Databases
I'm actually getting fuzzy about List, but imsr, if you set a C; and D; on the two fields, this should work:
LIST MYHOTELS  Option = "Blue" HotelName Option= "Blue" Price

Note the doubled Option=blue, the first select Items with Blue, the second restricts the multivalue listing to Blue, and tne C - D link should inhibit Price to match.

Am I right?
Chandru

chandru murthi

unread,
Aug 27, 2022, 1:30:37 PM8/27/22
to Pick and MultiValue Databases
Well, WRONG (and there should be a WITH iac above!.) No edit?!
OK, you need to create a field with A;N(Option):N(Price), say OptPrice.
LIST MYHOTELS  WITH OptPrice = "Blue70" HotelName Option= "Blue" Price

krnntp

unread,
Aug 27, 2022, 6:05:58 PM8/27/22
to mvd...@googlegroups.com
I could have sworn UniData had something like "WITH ASSOCIATED" or "WITH.ASSOC"? It has been awhile. It could have been a keyword or subroutine for use within an I-descriptor. I know that when straightforward selection failed me I would usually resort to writing an I-descriptor, and often as not a subroutine which simplified matters. 

Bill H

unread,
Aug 28, 2022, 11:53:23 AM8/28/22
to Pick and MultiValue Databases
I'm pretty sure UniData CANNOT use the "WHEN" keyword in a SELECT statement (or 'select' if in PICK mode).  It is only useful for output.

Wols Lists

unread,
Aug 28, 2022, 12:39:17 PM8/28/22
to mvd...@googlegroups.com
On 28/08/2022 16:53, Bill H wrote:
> I'm pretty sure UniData CANNOT use the "WHEN" keyword in a SELECT
> statement (or 'select' if in PICK mode).  It is only useful for output.

I'm pretty certain UniVerse sometimes returns "key @vm value" in select
lists. This presumably covers this very use case. I've just never used
it myself, so I don't know.

This of course will mess up naive BASIC code doing a READLIST, REMOVE
... :-)

Cheers,
Wol
Reply all
Reply to author
Forward
0 new messages