Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Number conversion
Message
 
To
21/06/2011 08:06:53
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01514858
Message ID:
01515301
Views:
101
Well, this being Foxpro, why not use a cursor (or even better a table that it can be updated for future values), something like:
CREATE CURSOR cData (PK I, Value I) && If this is a table then we have flexibility for future PKs and/or updated values
INDEX ON PK CANDIDATE TAG PK

INSERT INTO cData (PK, Value) VALUES (1, 24)
INSERT INTO cData (PK, Value) VALUES (2, 34)
INSERT INTO cData (PK, Value) VALUES (3, 50)
INSERT INTO cData (PK, Value) VALUES (4, 59)
INSERT INTO cData (PK, Value) VALUES (5, 74)
INSERT INTO cData (PK, Value) VALUES (6, 84)
INSERT INTO cData (PK, Value) VALUES (7, 97)

REPLACE FieldZ WITH IIF(INDEXSEEK(FieldZ, .t., 'cData', 'PK'), cData.Value, FieldZ) && or null or -1 or whatever

or

REPLACE FieldZ WITH cData.Value FOR INDEXSEEK(FieldZ, .t., 'cData', 'PK') 

or

UPDATE myTable SET FieldZ = cData.Value Select cData.Value from myTable join cData on cData.PK = FieldZ
* Probably wrong as I wrote it from memory and my memory is bad 
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform