Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hi all,
i got a problem.
I got a filed with 3 values:
- A
- B
- empty
I need to replace the empty fields with "C", i'm trying to build a new field using if functions without success, any suggestion?
Thanks
 MayilVahanan
		
			MayilVahanan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
Try like this,
Load *, if(Len(Trim(Field)) > 0, FieldName, 'C') as fieldname from tablename;
Hope it helps
 
					
				
		
but in the new field i should also keep A and B
 MayilVahanan
		
			MayilVahanan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
Len(Trim(FieldName)) gives the length of the field value, if is less than 1 means, it replace the empty string with 'C' otherwise it keeps the original value. so, A and B also there .
If(Len(Trim(FieldName)) >0 , FieldName, 'C') gives A,B and C
Hope it helps
 
					
				
		
is not working...maybe the syntax is incorrect 
 
					
				
		
 CELAMBARASAN
		
			CELAMBARASAN
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Can you post the syntax you used?
 MayilVahanan
		
			MayilVahanan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
Check the attached file..
 
					
				
		
if(Len(Trim([Tipo ])) > 0, [Tipo],'C') as "AA"
In the new columns it gives me the correct field (a & b), but still left empty the empty ones
 
					
				
		
I also tried with
if([Tipo]='A','A', if([Tipo]='B','B','C')) as "AAA"
and
If (IsNull([Tipo]),'C', [Tipo]) as "BBB"
but is still have no C
It seems like the fields are not empty, consider that they are populated as calculation of other fields
 
					
				
		
This is a formatting problem
You need to format you inline as txt
Load
 *
,if(Len(Trim(Testing))<>0, Testing, 'C') as Test Inline
[
Testing,Value
A,1
B,2
,3
D,4
](TXT); 
