Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 raadwiptec
		
			raadwiptec
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
 
					
				
		
 r3iuk
		
			r3iuk
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
 Gysbert_Wassena
		
			Gysbert_WassenaSomething like this maybe:
LOAD
[Invoice type],
Location,
If(Match([Invoice type],'100','101','105','107','109','190') or (Match([Invoice type],'200','201') and Len(Trim(Location))=0), -Price, Price) as Price
FROM
...source...
;
 raadwiptec
		
			raadwiptec
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Gysbert,
Can you give me in expression ?
 raadwiptec
		
			raadwiptec
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		and secondly invoice type 200 and 201 should be considered only when location is empty
 Gysbert_Wassena
		
			Gysbert_WassenaIf you don't like the expression I posted please explain what expression you want instead.
 raadwiptec
		
			raadwiptec
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		hi gysbert
Iam looking an expression for the front end and not at the script level.. secondly as said invoice type 200 and 201 should be considered only when location is empty
 Gysbert_Wassena
		
			Gysbert_WassenaWell, I think you should fix this in the script, but the expressions works just as well in a chart.
 raadwiptec
		
			raadwiptec
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		can you provide me both?
 Gysbert_Wassena
		
			Gysbert_WassenaIf(Match([Invoice type],'100','101','105','107','109','190') or (Match([Invoice type],'200','201') and Len(Trim(Location))=0), -Price, Price)
 raadwiptec
		
			raadwiptec
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		hi gybert this is not correct..invoice type 200 and 201 should be considered only when location is empty and price should price * -1
