Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple tests in an if
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00470871
Message ID:
00471859
Views:
34
How about;

Ans = IIF(cstr_lata$'120,122,...',FUNCTION,Ans)

Assuming cstr_lata is a string (guessing by name) otherwise use STR function to make it a string. For that number of choices it should be fast.

Bob


>Not sure this is what you need, but you may want to consider it.
>* For this guy, the bucket name was lnCarrierAIRFreightShippedTotal. Rather than asking a bunch of IF(s) to isolate a pointer, the pointer name was cocancenated based on text in a shipping instruction field:
>
* CarrierTyp="AIRFreight"  (a memory varaible name stored in a Shipping instruction field).
>lcCarrierTypeSub=[ln]+carriertyp+[ShippedTotal]
>* Now add the quantity to the macrotized bucket
>&lcCarrierTypeSub=&lcCarrierTypeSub+volmoved
>
>>I am trying to use an if statement to test a condition.
>>I only want to do the body of the if when CStr_Lata = X.
>>the problem is that I have about 80 values for X that should make the condition true. I tried using or's in between like:
>>cstr_lata = 120 or cstr_lata = 122 or....
>>
>>and so on, but it gets really long and i am sure it is slow. I also thought about using the in statement:
>>if cstr_lata in(120,122,....)
>>but i am not sure if that will work.
>>Would an array works better?
>>Any ideas how i can test for one of about 80 values being true?
>>Thanks,
>>Ryan Uhl
'If the people lead, the leaders will follow'
'War does not determine who is RIGHT, just who is LEFT'
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform