Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
Dear farolito20,
if i understand your question correctly,
if you want to add a cloumn to the existing QVD file
as you said the qvd contains id,name,age.
i think you want to add City column with Null value.
then
you need to write like in the script.
Null() as CIty.
Thanks,
Mukram.
Yes, but this work in the first load. What about the next? if a add rows with a value in city, this will be null()
I need to identify wich rows don't have the city columns
Rebuild the QVD and then save again.
TheQVD:
LOAD
ID,
Name,
Age,
If(Len(City)>0,City,Null()) AS City
FROM TheQVD.qvd (qvd);
STORE TheQVD INTO TheQVD.qvd;
This should overwrite the existing one.
Jonathan
Dear farolito20,
you mean you want to find which rows have Null values?
If possible can you post your QVW file.
Thanks,
mukram.
Ok, but if not exist this give an error, qv not found city
I need which rows not have this columns. If one row not have t_seak put null, else t_seak
Dear farolito20,
write the below script before loading your table.
as you said if one row not have t_seak value it will keep NULL as value in that row.
Map_Nulls:
Mapping LOAD
NULL(),'NULL'
AutoGenerate 1;
MAP * using Map_Nulls;
i hope it will help you.
else post the sample file.
Thanks,
Mukram.
DimOld:
LOAD
%KeyCustomer,
t_bpid,
t_nama,
t_seak,
t_ccur,
ValidFrom,
ValidTill,
MostRecent,
Autonumberhash256(t_bpid,t_nama,t_seak,t_ccur) as Checksum
FROM DimCustomers_Day0.qvd (qvd);
but in the first load, old rows not have t_seak column, so when I load this, I have an error becuase qv not found the t_seak.