Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i need to write and expression for the following below..
I have the following columns in my source.
Invoice type
Location
Price
i need an expression for the following condition
invoice type should be 100,101,105,107,109,190 plus if location is null --invoice type should be 200 and 201 , then output should be Prices * -1
Looks correct to me. Point out the error please.
how is this condition getting fulfilled?
invoice type 200 and 201 should be considered only when location is empty and output is price * -1
Just to make sure we both understand boolean logic the same way perhaps you should Google for "boolean and operator" to find out what an and does between two conditions.
Gysbert's answer is correct according to my interpretation of your requirement. However it can be tricky sometimes to read complex if statements when they are written on one line so I often break them up into separate lines to check they are constructed in the way that I want them to be. So Gysbert's statement can be written as:
if(
Match([Invoice type],'100','101','105','107','109','190')
or
(
Match([Invoice type],'200','201')
and
Len(Trim(Location))=0
),
-1,
1
) * Price
You could write a more long winded version which you may or may find more understandable, but I would stick with Gysbert:
if(
Match([Invoice type],'100','101','105','107','109','190'),
-1,
if(
Match([Invoice type],'200','201')
and
Len(Trim(Location))=0,
-1,
1
)
) * Price
Hi Mike .Gybs
Indeed both looks same, other than the -1 and the -Price at the end..
thanks both