Forum Discussion
Operators AND - OR in Nested IF
- 9 years ago
Many thanks for your advices.
I tried to split in 4 different columns. Doing that I realized that 1st IF should have a differente logic:
IF ( ZV[OrgCom] = "CUSTORG" && ZV[IDCust] = "491" && ( ZV[IDDel] = "SPD99" || ZV[IDDel] = "WAR99" || ZV[IDDel] = "DPD99" || ZV[IDDel] = "FOC99" || ZV[IDDel] = "KBD99" ) && (ZV[CounFinGood] <> "MX" && ZV[CounFinGood] <> "RU" && ZV[CounFinGood] <> "AR" && ZV[CounFinGood] <> "CN"); "1CS";Now I have changed the orginal long formula and it is ok.
Thanks again.
Whilst the second column you mention the formula is incomplete if we assume it simply returns blank when not "2CS" then I'm with you in so far as I can't see how that can work yet the first calculated column believes the value isn't a match and falls out as blank().
I also agree the structure of the formula whilst not idea should achieve what you describe you want.
Have you checked an individual row in the table to see what the first column returns for a record that matches:
[OrgCom] = "CUSTORG"
&& ZV[IDCust] = "491"
&& ZV[CounFinGood] = "MX" You could of course create 4 columns, one for each IF statement and a 5th column that concatonates the result. (assuming no record can match more than one IF statement, if the order is important then simply create the 5th column to return the first when not blank else the second and so on.
Not efficient in terms of storage but should have the same effect.
Sorry,
I have copied it partially.
IF (
ZV[OrgCom] = "CUSTORG"
&& ZV[IDCust] = "149"
&& (ZV[CounFinGood] = "MX"
|| ZV[CounFinGood] = "RU"
|| ZV[CounFinGood] = "AR"
|| ZV[CounFinGood] = "CN")
;
"2CS";
BLANK();
)- gpiero9 years agoSkilled Sharer
Many thanks for your advices.
I tried to split in 4 different columns. Doing that I realized that 1st IF should have a differente logic:
IF ( ZV[OrgCom] = "CUSTORG" && ZV[IDCust] = "491" && ( ZV[IDDel] = "SPD99" || ZV[IDDel] = "WAR99" || ZV[IDDel] = "DPD99" || ZV[IDDel] = "FOC99" || ZV[IDDel] = "KBD99" ) && (ZV[CounFinGood] <> "MX" && ZV[CounFinGood] <> "RU" && ZV[CounFinGood] <> "AR" && ZV[CounFinGood] <> "CN"); "1CS";Now I have changed the orginal long formula and it is ok.
Thanks again.
- Anonymous9 years agoNot applicable
Hi gpiero,
From your description, you have solved this issue, right? If that is the case, you can accept your reply as solution, that way, other community members would benefit from your solution.
Thanks,
Lydia Zhang