...Whenever I add the [current_typeID] option everything breaks...
Hi Talktozee. What do you mean when you say everything breaks?
As Delerna said, your statements 1 and 2 are quite different to statement 3, which as he pointed out was only true if either of the first two conditions AND the third condition were true.
As it is difficult to see the structure of a linear IIF statement I broke down your statement 1 into its logical IF-THEN-ELSE equivalent, then took out the redundant statements and reformed an IIF from the result. It is quite telling...
- If [transfer_to]=0 then
-
return [amount]
-
elseif [transfer_to]=[current_investorID] then
-
return [amount]
-
elseif [current_typeID]<6
-
return [amount]
-
else
-
return 0
-
endif
removing the redundant ELSEIFs by ORing the conditions together
- If ([transfer_to]=0) OR ([transfer_to]=[current_investorID]) OR ([current_typeID]<6) then
-
return amount
-
else
-
return 0
-
endif
which in IIF form is just
- IIF(([transfer_to]=0) OR ([transfer_to]=[current_investorID]) OR ([current_typeID]<6),
-
amount, 0)
identical to your statement 2 that you say does not work. As Delerna pointed out, getting the logic right is difficult, sometimes, and I wonder if you are testing the right types of values, as your statements 1 and 2 are logically equivalent?
-Stewart