Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
farolito20
Contributor III
Contributor III

add a column to qvd

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?

13 Replies
farolito20
Contributor III
Contributor III
Author

I don't understand how to use that mapping :S

Anonymous
Not applicable

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
Contributor III
Contributor III
Author

And where I can put

Autonumberhash256(t_bpid,t_nama,t_seak,t_ccur)as Checksum
Anonymous
Not applicable

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