Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conditional Insert
Message
From
30/10/2015 04:36:12
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
To
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:
01626689
Views:
68
>>>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.

But VFP's CASE actually is ELSEIF (with implicit break after first hit).

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

Any conditional processing in such a case is a dangerous kludge which will break when a mouse farts. The gather in a function is actually the only simple and elegant solution that I saw here. Besides, there's no danger of overstepping any outside variables, as parameters always hide any variable with the same name existing in the caller or above. This has been so since the days of foxplus (learned that the hard way).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform