Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This code is part of my load script , but does not give the correct results.. for some reason it is not validating the second part (code2) - it gives results only based on the first part
IF(Match(left(Code1,3),'N22','44C','XYX','CDC','CDI','UDU') and Not Match(left(Code2,3),'','N22','44C','XYX','CDC','CDI','UDU'),[CountryCode]
IF(Match(left(Code1,3),'N22','44C','XYX','CDC','CDI','UDU') and Match(left(Code2,3),'','N22','44C','XYX','CDC','CDI','UDU'),'M')
'No Code'))
Could you clarify (and ideally post an example) of what is not being applied correctly? Aside from that, this specific expression doesn't look like it'll parse, there should be a comma after the CountryCode and the second if() is closed before the else No Code part.
may be it was a copy paste issue
so the script is not validating/Parsing the second part --Match(left(Code2,3),'','N22','44C','XYX','CDC','CDI','UDU')
Iam getting output 'Z' with the wrong combination of Code 2
for Ex:
if N22 exists in Code 1 then in Code 2 either of them should exist -- '','N22','44C','XYX','CDC','CDI','UDU' but iam getting wrong combination output
Code1 Code 2 Checks
N22 F60 Z
N22 '' Z - This is correct
IF(Match(left(Code1,3),'N22','44C','XYX','CDC','CDI','UDU') and Match(left(Code2,3),'','N22','44C','XYX','CDC','CDI','UDU'),'Z') as Checks
This looks correct to me, so I'm not sure what the problem is. Are you sure your Code2 is actually a blank string '' rather than, say, null?
in my data - Code1 has values N22, XYX and Code2 has values null ,N22,XYX . So my results in check should have atleast 1 'Z'. Currently iam getting blanks by the same code ..
When i tried to run this in SQL same logic using IN Statement. It works correctly
null is not the same as blank and it will not match with ''. I don't know if you can match with a null value, but I'd suggest using coalesce(Code2,'') to replace the nulls with a blank string.