Information générale
Titre:
Newbie Question Re Saving individual records
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement