Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Generic address

Hey guys, I have an Issue.

Every day I store a qvd (to make a daily historic) named 'mkt'&date and everytime I want to load the historic, I just make a load like that: LOAD * From \\...mkt*.qvd(qvd);...

I will have to add a new field, but this field will only exist in the new qvds. I tried to make it, but when I tried to load, it went wrong.

Do you guys know any solutions?

Sincerely, Luiz

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hello Luiz,

The below script will add a new field and replace all your historic qvd's in the same path (Including sub directories). I would suggest (Just to be safe) to take a copy of your qvd's in a separate folder and then try.

Sub ScanFolder(Root)

          For each FileExtension in 'qvd'

                   For each FoundFile in filelist( Root & '\*.' & FileExtension)

                              HistoricData:

                              Load *,

                              '' as NewFieldName

                               From

                              '$(FoundFile)' (qvd);

                        

                         Store HistoricData into '$(FoundFile)' (qvd);

                         DROP Table HistoricData;

                  Next FoundFile

          Next FileExtension

         For each SubDirectory in dirlist( Root & '\*' )

                    Call ScanFolder(SubDirectory)

          Next SubDirectory

End sub

Call ScanFolder('YourFilePath') ;

View solution in original post

2 Replies
sunny_talwar

What was the name of the new file?

tamilarasu
Champion
Champion

Hello Luiz,

The below script will add a new field and replace all your historic qvd's in the same path (Including sub directories). I would suggest (Just to be safe) to take a copy of your qvd's in a separate folder and then try.

Sub ScanFolder(Root)

          For each FileExtension in 'qvd'

                   For each FoundFile in filelist( Root & '\*.' & FileExtension)

                              HistoricData:

                              Load *,

                              '' as NewFieldName

                               From

                              '$(FoundFile)' (qvd);

                        

                         Store HistoricData into '$(FoundFile)' (qvd);

                         DROP Table HistoricData;

                  Next FoundFile

          Next FileExtension

         For each SubDirectory in dirlist( Root & '\*' )

                    Call ScanFolder(SubDirectory)

          Next SubDirectory

End sub

Call ScanFolder('YourFilePath') ;