Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conditional Insert
Message
From
29/10/2015 15:02:31
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
 
 
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:
01626655
Views:
63
>>Truthfully, there is no simple elegant approach for what Dmitry was looking for.

The question posed 3 fields any of which may or not be present so the options are: (binary 1 for present, 0 for absent)

111
110
101
011
100
010
001
000

IOW 8 options for 3 fields. IF isn't practical in the absence of ELSEIF so you'd need 8 CASE statements with 8 INSERT commands.

Increase the number of fields to 4,5,6... and soon you're into the hundreds of options.

And still the single-line function I proposed, works just fine with 3 or 30 fields, simply by updating the passed parameters.

You do understand why it works, right?

>>Maybe we should reach out to "RV Boy". He might have some good suggestions :)

LOL. RVBoy would say that this solution works just fine in a RV against any backend. ;-)
"... 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