|
|
Joined: Jan 2013
Posts: 25
Adagio Enthusiast
|
|
Adagio Enthusiast
Joined: Jan 2013
Posts: 25 |
What is the proper way to use multiple IF/OR/AND statements. In this particular case I want to:
Find {Item #} containing "YX" or "ZB" or "TV" and {Amt} * 2% Everything thing else I want {Amt} * 3.25%
I can get one function working:
IF( FIND("YX",{Item #},1), {Amt} * 2%, {Amt} * 3.25% )
But I am unsure on how to add the other two.
Thanks,
Lance Tennier TDL Canada
|
|
|
|
|
Joined: Aug 2011
Posts: 476
|
|
Joined: Aug 2011
Posts: 476 |
Looks like you want to insert the OR function for the first parameter of the IF statement, for its arguments you'll replicate that find function once per each string you are searching for: IF( OR(Find#1, find#2, find#3), do x, do y )
|
|
|
|
|
Joined: Jan 2013
Posts: 25
Adagio Enthusiast
|
|
Adagio Enthusiast
Joined: Jan 2013
Posts: 25 |
Thanks Warren,
I tried:
IF( OR( FIND("YX",{Item #},1), FIND("ZB",{Item #},1), FIND("TV",{Item #},1), ) {Amt} * 2%, {Amt} * 3.25% )
I cannot get it to verify. What would be the error?
Thanks,
Lance Tennier TDL Canada
|
|
|
|
|
Joined: Mar 1999
Posts: 11,746
Adagio Action Team
|
|
Adagio Action Team
Joined: Mar 1999
Posts: 11,746 |
Remove the comma after the last FIND statement:
IF( OR( FIND("YX",{Item #},1), FIND("ZB",{Item #},1), FIND("TV",{Item #},1) ) {Amt} * 2%, {Amt} * 3.25% )
Regards, Softrak Tech Support
|
|
|
|
|
Joined: Jan 2013
Posts: 25
Adagio Enthusiast
|
|
Adagio Enthusiast
Joined: Jan 2013
Posts: 25 |
I hate to be a pain, but I have copied that exact formula into Gridview and I still fail the verification.
Lance Tennier TDL Canada
|
|
|
|
|
Joined: Jun 2004
Posts: 3,692
Adagio Wizard
|
|
Adagio Wizard
Joined: Jun 2004
Posts: 3,692 |
IF( OR( FIND("YX",{Item #},1) > 0, FIND("ZB",{Item #},1) > 0, FIND("TV",{Item #},1) > 0 ) {Amt} * 2%, {Amt} * 3.25% )
|
|
|
|
|
Joined: Aug 2011
Posts: 476
|
|
Joined: Aug 2011
Posts: 476 |
Lance, I think the issue is that all of the if statements posted after my initial reply are lacking the comma to separate out the OR function as the #1 parameter of the IF statement. You had the correct number of commas the first time, just not in the right place: If ( Or (find(xxxx)) , do x, do y )
I haven't used the find function in a little bit but Bruce's suggestion of ensuring the find functions are returning a value >0 is worth considering. The if statement might recognize the returned 0 as false and go to the final part without that, but I'm not sure.
|
|
|
|
|
Joined: Jun 2004
Posts: 3,692
Adagio Wizard
|
|
Adagio Wizard
Joined: Jun 2004
Posts: 3,692 |
Yes, Warren is correct (he has younger eyes).  The comma was missing. IF( OR( FIND("YX",{Item #},1) > 0, FIND("ZB",{Item #},1) > 0, FIND("TV",{Item #},1) > 0 ), {Amt} * 2%, {Amt} * 3.25% )
|
|
|
|
|
Joined: Feb 2008
Posts: 1,247
Adagio Maestro
|
|
Adagio Maestro
Joined: Feb 2008
Posts: 1,247 |
Thanks guys! It's working perfect now. 8-)
Susan Tennier TDL Canada Trenton, Ontario
|
|
|
|
0 members (),
77
guests, and
3
robots. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Forums5
Topics14,679
Posts71,625
Members1,874
| |
Most Online1,408 Dec 9th, 2025
|
|
|
S |
M |
T |
W |
T |
F |
S |
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
|
29
|
30
|
|
|
|
|
|
|
|
|