PxPlus User Forum

Main Board => Discussions => Language => Topic started by: Peter.Higgins on February 07, 2020, 10:15:36 AM

Title: Unique alternate key question.
Post by: Peter.Higgins on February 07, 2020, 10:15:36 AM
I am curious if it is possible to make an alternate multi-segment key unique in the dictionary where the secondary segments may repeat for other primary segments but should not for the primary segment which is also the first segment of the prime key?  Thinking no-way but hope to be surprised.

Title: Re: Unique alternate key question.
Post by: Mike King on February 07, 2020, 10:37:38 AM
I'm not certain I follow what you are looking for, but in the primary key for any file MUST be unique.

Given this; if the full primary key is part of an alternate key, that portion of the alternate key will be unique and thus logically you will never have duplicate alternate keys regardless of whether you tell the system they are unique or not.
Title: Re: Unique alternate key question.
Post by: Peter.Higgins on February 19, 2020, 09:22:59 AM
Thanks Mike,
   
The original creator of this key obviously had not worked with record scrolling in BBX emulation mode or they would have known how good an idea that is.
 
Title: Re: Unique alternate key question.
Post by: Mike King on February 19, 2020, 11:04:35 AM
Peter,

Generally I always suggest that you never allow duplicate alternate keys as it makes the logic to traverse the key chain challenging especially if you are trying to scroll or page through the data. 

Trying to re-establish the proper current record when using a key that allows duplicates is much more difficult.