Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conditional Insert
Message
From
29/10/2015 14:54:40
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
 
 
To
28/10/2015 19:13:41
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01626580
Message ID:
01626652
Views:
63
Al,

>>- you can inadvertently step on existing memvar values unless you carefully manage their names

The variables in the function are passed by value so don't affect existing variables.

>>- If you just have 2 possible INSERT statements, run the correct one via IF...ENDIF as you suggest

>>- If you have a few of them, use DO CASE...

In fact the question referred to field1 or any other meaning that a single IF does not answer the posed question. In fact you're into mathematical combinations or permutations needing at least 8 CASEs to cover all the possibilities for 3 fields. Hence my solution that cheerfully copes even as the number of fields increases past 3 and the CASEs rise into the hundreds.

What was interesting here was an OP suggesting that somebody trying to help, ought to be "constructive." An unusual attitude in VFP. I'll be sure not to offer my useless suggestions to such a person again. ;-)
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us.
"
-- Shakespeare: Coriolanus, Act 1, scene 1
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform