Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String Comparisons
Message
From
01/02/2000 17:10:51
 
 
To
01/02/2000 16:36:57
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00325827
Message ID:
00325843
Views:
15
>I have a problem with my nested immediate if statement. The problem is if a materialid equals VX5 it is given it the value of qty2 when it should be given the number 1. It is VX50 or VX57 that have to be an exact match to receive the value of qty2. The same is true for the rest of them.
>
>Here is my statement.
>
>iif(alltrim(materialid) $ "VX29,VX39", qty3, iif(alltrim(materialid) $ "VX57,VX50", qty2, (iif(alltrim(materialid) $ "VX51",qty, (iif (alltrim(materialid) $ "CJ30,CJ31,CJ32,CJ33,CJ34,CJ35,CJ36,CJ37,CJ38,CJ39,CJ40", "2","1"))))))
>
>Can anyone help me with the correct syntax that will give me the totals that I want.
>

The problem is ALLTRIM() the string "VX5" occurs in the strings "VX57,VX50" and in the string "VX51" as well. You need to rethink things a bit to not use a substring and IIF(), perhaps using INLIST() rather than the $ operator, or better might be an inner join with a separate table that matched materialid and the correct field prior to the actual query...
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform