Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF inside a query.
Message
From
07/01/2003 10:25:08
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
07/01/2003 10:00:18
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00738770
Message ID:
00738782
Views:
18
>Hello at alls.
>
>I wonder to know how many IIF nested Can I put inside a query.
>
>TIA.

I have seen 10 or 12 nested IIFs. But your program would be more readable if you create a UDF that returns the value.

For instance, instead of:
iif(cMonth = "JAN", 1, iif(cMonth = "FEB", 2, ...
you could use:
FUNCTION MonthNum(cMonth)
do case
case cMonth = "JAN"
  return 1
case cMonth = "FEB"
  return 2
...
HTH, Hilmar.
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
Next
Reply
Map
View

Click here to load this message in the networking platform