Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vfp50 - Auto Numbering
Message
De
22/04/1997 12:40:05
Larry Long
ProgRes (Programming Resources)
Georgie, États-Unis
 
 
À
22/04/1997 09:33:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00029060
Message ID:
00029282
Vues:
36
>>>>>>The question is if the user need to see it before he save it May be not but i agree with you if you want to show what is a auto number may be it's easier if you can show it. Personnaly if you really need continus chain of number {1,2,3,4,5,6,....} I think that's better to generate your number after the save action but if you can live with uncontinus chain number {1,3,4,6,....} show it before save action it's better ...
>>>>>>
>>>>>>Rocky Boy...
>>>>>
>>>>>Do think it is important to have a continues chain of numbers or does it really matter?
>>>>
>>>>What is use for ? I
>>>
>>>Look up ID numbers.
>>
>>Personnaly i prefer the continus chain for id. It's generaly more clear for everyone but the uncontinus chain can't faily did the job well. So it's your choice.
>>
>>Rocky boy ...
>
>thanks... I think I will add an auto number when they pick ADD A RECORD
>even if they do not SAVE THE RECORD.
If you do it that way, maybe one way to help save space and skipped numbers it to put some kind of flag (perhaps deleted(), if you delete unused records) and search for unused records as the user's next record, before incrementing. Possibly something like...

...after ADD button

SELECT targetdbf
SCATTER MEMVAR BLANK
SET ORDER TO 0
*ASSUMING THERE IS A TAG ON DELETED()

STORE .F. TO OLD_USED

SCAN FOR DELETED()
IF RLOCK()
STORE targetdbf.counter to m.showcounter
STORE .T. TO OLD_USED
RECALL
EXIT
ENDIF
ENDSCAN

IF NOT OLD_USED
*** PUT GET NEXT COUNTER CODE FROM COUNTER.DBF HERE
STORE counterdbf.counter to m.showcounter
INSERT INTO targetddf from memvar
ENDIF

** GET USER INPUT USING MEMVARS (i.e m.Field1, m.Field2,...)

** AFTER VALIDATION
SELE targetdbf
SET ORDER TO COUNTER
SEEK m.showcounter

IF NOT IS_OK && USER CANCELLED
DELETE
ELSE
GATHER MEMVAR
ENDIF

UNLOCK

Hope this helps some!
L.A.Long
ProgRes
lalong1@charter.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform