Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
Not applicable

Add a column to existing QVD





Below is my script to load data from a QVD i created before hand. However i would like to add another column in this script and all the values in this new column will be the same.

So i need to add another column called FUND and it should be populated with SPRS for all the values.

Directory;

PCPCapTable:

LOAD

AffPdExt as DateofService

FROM

qvd\PCPCapTableMCRProject.qvd

(qvd);

Thanks

Krishan







1 Solution

Accepted Solutions
MVP
MVP

Re:Add a column to existing QVD

Like this? Or did you want to put the column IN the QVD itself, not just in your application?

Directory;
PCPCapTable:
LOAD
AffPdExt as DateofService
,'SPRS' as FUND
FROM qvd\PCPCapTableMCRProject.qvd (qvd);

11 Replies
Not applicable

Add a column to existing QVD

Try with this:

LOAD

AffPdExt as DateofService,

FUND AS SPRS

FROM

qvd\PCPCapTableMCRProject.qvd

(qvd);

Regards,







Not applicable

Re:Add a column to existing QVD

Unfortunetly that did not work. It errors out.

Not applicable

Add a column to existing QVD

Share you application. I can help you.

Regards,

Not applicable

Re:Add a column to existing QVD

For security reasons i cannot but the script is pretty simple. I just need to add the extra column.

Thanks.

MVP
MVP

Re:Add a column to existing QVD

Like this? Or did you want to put the column IN the QVD itself, not just in your application?

Directory;
PCPCapTable:
LOAD
AffPdExt as DateofService
,'SPRS' as FUND
FROM qvd\PCPCapTableMCRProject.qvd (qvd);

Not applicable

Re:Add a column to existing QVD

Thank you this worked.

Initially i tried this but i had the "comma" after the word date of service instead of at the beginning of the next line. Weird how that works.

Thanks again.

MVP
MVP

Re:Add a column to existing QVD

The position of the comma actually shouldn't make any difference, so maybe it was just a typo or something. Anyway, glad you got it working now.

Not applicable

Add a column to existing QVD

I have daily QVD files for 3 years. I need to add a couple of columns to each of them with default value (NULL actually). Can I do this without reloading the data? Otherwise it will be huge amount of data and time to do this

MVP & Luminary
MVP & Luminary

Add a column to existing QVD

I don't think you can do this reliably without reading and writing each QVD. You can do that in a filelist loop pretty easily.

Depending on how you are reading these old files, you may consider just introducing the new field as it's needed by someone consuming the old qvd. you can proably detect that the field is missing by checking something like QvdNoOfFields().

-Rob