Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Newbie Question Re Saving individual records
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Newbie Question Re Saving individual records
Divers
Thread ID:
00002104
Message ID:
00002104
Vues:
100
I've been working w/record oriented language for many years, and VFP for a few weeks of study, following manuals, books, etc.
My first effort at building a small parent/child app, just to do something besides follow the stuff in the books, Mastering VFP,... are stopped at the point of creating an id number for each file.

I build a small table, with two fields:
cDescrip, 10 - holds an identifier for the specific table to be updated.
cNextId, 6.0 - hold the next number to be used.

My thought was to place a function in the INSERT table rule to open the "NEXTNUM" file, get the next number, increment the next number in NEXTNUM, then return the retrieved value to the record being created.
It looked like this:
------------------------------------------
FUNCTION udfNextId
*
* Uses the existing next number for the field identified by
* cIdDesc as the ID number for a new record.
* Then increments the existing number, and stores it
* in NEXTNUM
*
PARAMETER cIdDesc
m.nRetVal = 0
SELECT 0
USE nextnum ORDER lookup
SET EXACT ON
SEEK cIdDesc
IF FOUND( )
m.nRetVal=nextnum
nextnum = (nextnum + 1)
END
RETURN m.nRetVal
-------------------------------------------------
I wonder if i'm even on the right track, and if so, what the function should look like in the trigger, and secondly, I couldn't get the program to even find the function. It kept telling me it couldn't find "ufdnext.prg", which was shown in the project list.
I'm not sure this is the proper way to submit this, either.
Thanks for any help anyone could provide.

Jerry McDonald
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform