PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Unique alternate key question.  (Read 1259 times)

Peter.Higgins

  • Diamond Member
  • *****
  • Posts: 124
    • View Profile
Unique alternate key question.
« 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.


Mike King

  • Diamond Member
  • *****
  • Posts: 3811
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Unique alternate key question.
« Reply #1 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.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Peter.Higgins

  • Diamond Member
  • *****
  • Posts: 124
    • View Profile
Re: Unique alternate key question.
« Reply #2 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.
 

Mike King

  • Diamond Member
  • *****
  • Posts: 3811
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Unique alternate key question.
« Reply #3 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.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com