Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 farolito20
		
			farolito20
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I have a qvd with this columns
id,name,age
but I add a new column, and I need to assign null() to old data without this value in this column
id,name,age,city
How to know which rows don't have a column?
 farolito20
		
			farolito20
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I don't understand how to use that mapping :S
 
					
				
		
I assume that this means that the QVD has not been loaded with City on any of it's rows and you want to provide for an exception where the structure is different to expectations.
Try something like this:
SET ERRORCODE = 0;
TheQVD:
LOAD
ID,
Name,
Age,
If(Len(City)>0,City,Null()) AS City
FROM TheQVD.qvd (qvd);
IF SCRIPTERROR=1 THEN // Field missing so load without City
TheQVD:
LOAD
ID,
Name,
Age
Null() AS City
FROM TheQVD.qvd (qvd);
ENDIF // SCRIPTERROR = 1
SET ERRORCODE = 1;
STORE TheQVD INTO TheQVD.qvd;
Hope that works for you.
Jonathan
 farolito20
		
			farolito20
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		And where I can put
| Autonumberhash256(t_bpid,t_nama,t_seak,t_ccur) | as Checksum | 
 
					
				
		
Are t_bpid, t_nama, t_seak and t_ccur the fields we were discussing before, namely ID, Name, Age and City.
If so, you can add the following two lines as the last fields in the two load statements I sent before.
Load 1. Autonumberhash256(t_bpid,t_nama,t_seak,t_ccur) as Checksum
Load 2. Autonumberhash256(t_bpid,t_nama,t_seak,null()) as Checksum
As City (t_ccur) is null in the second load statement, this should be a valid syntax.
Jonathan
