> On Mar 27, 2020, at 11:58 AM, Keisuke Miyako via 4D_Tech 
> <[email protected]> wrote:
> 
> not 100% sure, but maybe the duplicates are actually nulls.
I assume you are correct

> 
> if you display the UUID fields in a list form, and resize the window, do the 
> values change?


> 
> if yes, what you see are phantom UUIDs, there are actually null.
> 
> I assume you added auto-generating UUIDs, 
Yes I do
> I assume you did this in a v17.4 structure file, 
Yes I do
> I assume you opened a v13.x datafile,
> expecting that the newly created UUId filed would automatically be populated.
Yes I do
> 
> my question is, did the primary key wizard show up?
No it does not
> 
> or maybe I should ask, is the UUID also a primary key?
Yes it is


Additionally,
I have the following code to fix the problem. Only the tables which 4D tells me 
have duplicates are updated

READ WRITE(*)
C_LONGINT($TableNumber_L;$Primary_key_field_id_L)

For ($TableNumber_L;1;Get last table number)
        If (Is table number valid($TableNumber_L))
                $Primary_key_field_id_L:=0
                C_POINTER($Table_ptr;$Field_ptr)
                $Table_ptr:=Table($TableNumber_L)
                C_TEXT($ConstraintID_txt)

                Begin SQL

                        SELECT CONSTRAINT_ID
                        FROM _USER_CONSTRAINTS
                        WHERE TABLE_ID = :$TableNumber_L AND CONSTRAINT_TYPE = 
'P'
                        INTO :$ConstraintID_txt;

                        SELECT COLUMN_ID
                        FROM _USER_CONS_COLUMNS
                        WHERE CONSTRAINT_ID = :$ConstraintID_txt
                        INTO :$Primary_key_field_id_L;
                End SQL

                $Field_ptr:=Field($TableNumber_L;$Primary_key_field_id_L)
                ALL RECORDS($Table_ptr->)
                ARRAY TEXT($UUIDKeys_atxt;0)

                DISTINCT VALUES($Field_ptr->;$UUIDKeys_atxt)
                If (Records in selection($Table_ptr->)#Size of 
array($UUIDKeys_atxt))

                        APPLY TO SELECTION($Table_ptr->;$Field_ptr->:=Generate 
UUID)
                End if 
        End if 


End for 


------------------------------------------------------------------------------------------------
 Chuck Miller Voice: (617) 739-0306
 Informed Solutions, Inc. Fax: (617) 232-1064       
 mailto:cjmiller<AT SIGN>informed-solutions.com 
 Brookline, MA 02446 USA Registered 4D Developer                
       Providers of 4D and Sybase connectivity
          http://www.informed-solutions.com  
------------------------------------------------------------------------------------------------
This message and any attached documents contain information which may be 
confidential, subject to privilege or exempt from disclosure under applicable 
law.  These materials are intended only for the use of the intended recipient. 
If you are not the intended recipient of this transmission, you are hereby 
notified that any distribution, disclosure, printing, copying, storage, 
modification or the taking of any action in reliance upon this transmission is 
strictly prohibited.  Delivery of this message to any person other than the 
intended recipient shall not compromise or waive such confidentiality, 
privilege or exemption from disclosure as to this communication. 
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to