Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting a Unique Id (sort of)
Message
De
04/12/2001 09:08:59
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Getting a Unique Id (sort of)
Divers
Thread ID:
00589215
Message ID:
00589215
Vues:
75
I am trying to generate and capture a unique id using the sys3 command. Once a id is created it checks a table that holds all the previous id's that were generated, if the id is found in the table already, then continue with process until it comes across one that doesnt match and then write to the table. Is this code accomplishing this? I am finding duplicate records in my Keytable.dbf.
PARAMETERS mOdeType, pk_find

*LOCAL m.pk_find 

m.pk_find = .F.

IF !USED('KEYTABLE')
	USE (oVar.SysPath) + 'KEYTABLE.dbf' IN 0 SHARED
ENDIF

SELE KEYTABLE
GO TOP

*!*	SET MULTILOCKS ON
=CURSORSETPROP("BUFFERING",5)


DO WHILE m.pk_find = .F.
	oVar.KeyId = SYS(3)
	
	SELE KEY_ID FROM KEYTABLE ;
		WHERE ALLT(KEYTABLE.KEY_ID) == ALLT(oVar.KeyId) ;
		INTO CURSOR PkIdFound
	
	SELE PkIdFound
	IF RECCOUNT() > 0		&& PK ID FOR THIS PARTICULAR TABLE EXIST....LOOP
		m.pk_find = .F.
		LOOP
	ELSE
		m.pk_find = .T.
		DO CASE
			CASE ALLT(UPPER(mOdeType)) == 'UPDATE VTRANS'
				INSERT INTO KEYTABLE (KEY_ID, HTC_PROC) VALUE (oVar.KeyId, 'VTRANS UPDATE')	
		
			CASE ALLT(UPPER(mOdeType)) == 'PRINT REPORTS'
				INSERT INTO KEYTABLE (KEY_ID, HTC_PROC) VALUE (oVar.KeyId, 'PRINT REPORTS')
		
		ENDCASE
		
		SELE KEYTABLE
		=TABLEUPDATE(.T.)	
	ENDIF
ENDDO

RETURN
Thanks in Advance.

J. Turner
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform