Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MyTable.NextID
Message
From
25/09/2007 19:09:43
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
25/09/2007 18:53:57
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01256809
Message ID:
01256819
Views:
16
This message has been marked as a message which has helped to the initial question of the thread.
>I found that issue, but how do I find your article? Don't see a search function and the titles of the articles are truncated on the left sidebar for me.

No idea what went wrong. One way is through my contribution summary. On the other hand, when you go into any article, there is an index ComboBox at the top, where you can select an article.

Here are the two functions from the appendix, for your references.

1. SerialNumber(), requires a table SerialNumber.dbf (sequence C(20), nextnum I), and an index on Sequence. Function is placed in database stored procedures, and invoked from the field default value.

2. GUID - this is a longer key, 16 bytes. It should guarantee uniqueness, even if computers don't have permanent access to a central database.
* Function SerialNumber

* Get serial number. Used mainly to generate primary keys.
* The easiest way to achieve this is to call this function from a fields
* default value.
FUNCTION SERIALNUMBER(tnSequence)
tnSequence = lower(tnSequence)
local lnSelect
lnSelect = select()
if used("serialnumber")
   select serialnumber
   else
   select 0
   use serialnumber
endif
set order to "sequence"
seek padr(tnSequence, len(sequence))
if not found()
   append blank
   replace sequence with tnSequence, nextnum with 1
endif
local lnReturnValue
if lock()
   lnReturnValue = nextnum
   replace nextnum with nextnum + 1
   else
   lnReturnValue = -1
endif
unlock
flush
select (lnSelect)
return lnReturnValue
ENDFUNC
* Function for GUID
PROCEDURE GetGUID
DECLARE INTEGER CoCreateGuid ;
  IN Ole32.dll ;
  STRING @lcGUIDStruc

cStrucGUID=SPACE(16)
cGUID=SPACE(80)
nSize=40
IF CoCreateGuid(@cStrucGUID) # 0
  RETURN ""
ENDIF
return cStrucGUID
ENDPROC
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform