Hi all,
I have an IIf statement which combines 2 fields together to create field Expr2. The statement seperates the fields by a comma "," it also gets rid of the comma if the first field length is less than 4, it also checks if values are null. What i want to do is add an extra field to this, field A3, but i can't seem to get syntax correct.
This is what the statement looks like, this works but only takes 2 fields A1 and A2:
I want to add field A3 so that it is part of field Expr2. These are all the possible results that i want the code to achieve:
A1, A2 , A3
A1, A2 (A3 is null)
A1, A3 (A2 is null)
A1 A2, A3 (A1 is less than 4 characters)
A1 A2 (A1 is less than 4 characters + A3 is null)
A1 A3 (A1 is less than 4 characters + A2 is null)
Any help very much appreciated, thanks in advance,
M-.
I have an IIf statement which combines 2 fields together to create field Expr2. The statement seperates the fields by a comma "," it also gets rid of the comma if the first field length is less than 4, it also checks if values are null. What i want to do is add an extra field to this, field A3, but i can't seem to get syntax correct.
This is what the statement looks like, this works but only takes 2 fields A1 and A2:
Code:
SELECT IIf(IIf(len(a1)>0,Len(a1),0)<4,I1.A1 & " " & I1.A2,I1.A1 & IIf(IsNull([A2]),"",", " & [A2])) AS Expr2
FROM i1;
I want to add field A3 so that it is part of field Expr2. These are all the possible results that i want the code to achieve:
A1, A2 , A3
A1, A2 (A3 is null)
A1, A3 (A2 is null)
A1 A2, A3 (A1 is less than 4 characters)
A1 A2 (A1 is less than 4 characters + A3 is null)
A1 A3 (A1 is less than 4 characters + A2 is null)
Any help very much appreciated, thanks in advance,
M-.