Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Avoid repeated values with more than two users
Message
From
06/06/2008 15:24:07
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01322172
Message ID:
01322173
Views:
14
You can get unique values by implementing some locking -
one example is the newID.dbc that ships with VFP,
see also "Create a default unique id value for a field" in the Task Pane -> Solution Samples.



hth
-Stefan

>I want to make sure code generation is not repeating codes when using two instaces of the same form
>
>ped_test.dbf is buffered as 5
>
>Then I runned form 1 and form 2 at the same time with
>2 differents instaces of VFP, as below:
>
>
>***********************form 1 code**************************
>SELECT PED_TEST
>DO WHILE PED_TEST.COD < 100000
>
>
>dimension lctemp[1]
>select max(PED_TEST.cod) from PED_TEST ;
> into array lctemp
> lcTemp[1] = nvl(lcTemp[1],0)+1
>
> APPEND BLANK
>
>replace PED_TEST.COD with lctemp
>replace ped_test.id WITH "FORM 1"
> = TABLEUPDATE ()
> LOOP
> ENDDO
>
>
>***********************form 2 code**************************
>
>
>SELECT PED_TEST
>DO WHILE PED_TEST.COD < 100000
>
>
>dimension lctemp[1]
>select max(PED_TEST.cod) from PED_TEST ;
> into array lctemp
> lcTemp[1] = nvl(lcTemp[1],0)+1
>
> APPEND BLANK
>
>replace PED_TEST.COD with lctemp
>replace ped_test.id WITH "FORM 2"
> = TABLEUPDATE ()
> LOOP
> ENDDO
>**********************************************
>
>At the end of the test I have repeated values
>if I browse my two fields table I have something as:
>
>------------------------
>cod ---ID
>------------------------
>
>1000 - FORM 1
>1000 - FORM 2
>1001 - FORM 1
>1001 - FORM 2
>1002 - FORM 1
>1002 - FORM 2 , ETC
>
>
>I would like something as:
>
>
>1000 - FORM 1
>1001 - FORM 2
>1002 - FORM 1
>1003 - FORM 2
>1004 - FORM 1
>1005 - FORM 2 , ETC
>
>Can anybody imagine a better code to run my tests ?
Previous
Reply
Map
View

Click here to load this message in the networking platform