Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can i do that~~~~~~
Message
 
À
21/05/1997 03:33:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00033045
Message ID:
00033053
Vues:
38
>i have a two fields ,this two fields is customer code , ship, ship is a optiongroup in this optiongroup you have a two choose ,the two choose is "Over Sea" & "Local",Now i problem is i need auto crea the
>customer code, if they choose "Over Sea" than you program is auto show "OA001" ,next time they same as choose the "Over Sea" the program will auto show "OA002" and if they choose "Local" the Program will be auto show "LA001" , so i think ask all people how can i do this auto function ??????

Two choices off the top of my head. One maintain a lookup table which contains the last numeric value. In your case, two fields would be necessary in the table, Optiongrp and LastID. This is a commonly accepted approach.

The other choice is to grab the last ID when a user attempts to save the record using an SQL MAX(VAL(..)) routine. I have also used this technique to accompish the task. Then just use TRANS(LastIDfromSQL+1,'@L 999') to get the leading zeros...

I would recommend keeping the number part of your ID (last three digits) as a seperate field. Remember you can always concatonate fields for data entry display and reports. Speaking of the three number digits, is that enough. I usally all for two extra digits beyond what a user specifies. In more than one occassion, this has saved me time in re-coding stuff when they go beyond the number limit. In your case, 999 sounds a little small!

Well, htwh... Steve
Steve Medvid
Systems Analyst

Environmental Resource Management
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform