Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In Qlik Cloud, moving QVD files between different spaces is not a straightforward operation through the interface. However, with a simple loading script, you can automate the process and easily transfer multiple QVD files from one space to another.
This method involves the creation of a Qlik script that loads QVD files from one location (space) and stores them into a different space. Below is a step-by-step guide to implementing this technique.
Before running the script, ensure that you have the necessary permissions and that both source and destination spaces are properly configured in Qlik Cloud.
The script works by renaming the location of QVD files, loading them from the source space, and storing them in the target space.
In Qlik Cloud, moving QVD files between different spaces is not a straightforward operation through the interface. However, with a simple loading script, you can automate the process and easily transfer multiple QVD files from one space to another.
This method involves the creation of a Qlik script that loads QVD files from one location (space) and stores them into a different space. Below is a step-by-step guide to implementing this technique.
1 : Define your files
We start by naming the QVD files that need to be moved. These names should correspond to the files stored in the source space.
SET FileList= ‘File1,File2,File3’
This line initializes a variable FileList containing the names of the QVD files. You can list as many files as you want, separated by commas.
2 : Loop over the file list
The script uses a FOR loop to iterate over each table listed in the FileList. It splits the list using commas and processes each file one by one.
FOR i = 1 TO SubStringCount('$(FileList)', ',' ) + 1
LET var = SubField('$(FileList)', ',', $(i));
This segment identifies each table in the list and assigns it to the variable var.
3 : Loop over the file list
For each table, the script defines the path of the QVD file in both the source and target spaces.
LET oldQVD = 'lib://OLDSPACE:DataFiles/$(var).qvd';
LET newQVD = 'lib://NEWSPACE:DataFiles/$(var).qvd';
Here, oldQVD is the path to the source QVD file, and newQVD is the new path in the target space. Make sure to adjust these paths to match your Qlik Cloud environment.
4 : Load and Store the Data
The script loads the data from the source space and stores it in the destination space.
TRACE ‘Moving of the file from $(oldQVD) to $(newQVD)';
[$(var)]:
LOAD * FROM [$(oldQVD)] (qvd);
STORE [$(var)] INTO [$(newQVD)](qvd);
DROP TABLE [$(var)];
NEXT
EXIT SCRIPT;
The TRACE command outputs information for monitoring the process.
The LOAD statement loads the QVD file from the source location.
The STORE command saves the data into the new QVD file in the target space.
The DROP TABLE command removes the table from memory after storing it.
Finally, the NEXT command is used to move to the next iteration in the FOR loop.
After processing all the QVD files, the script exits.
Once you've adjusted the paths and files names, simply run the script in the Qlik Cloud environment. This will move the specified QVD files from the source space to the target space, one by one.
Here’s the complete script you can use directly without having to copy-paste each section:
SET FileList= ‘File1,File2,File3’
FOR i = 1 TO SubStringCount('$(FileList)', ',' ) + 1
LET var = SubField('$(FileList)', ',', $(i));
LET oldQVD = 'lib://OLDSPACE:DataFiles/$(var).qvd';
LET newQVD = 'lib://NEWSPACE:DataFiles/$(var).qvd';
TRACE ‘Moving of the file from $(oldQVD) to $(newQVD)';
[$(var)]:
LOAD * FROM [$(oldQVD)] (qvd);
STORE [$(var)] INTO [$(newQVD)](qvd);
DROP TABLE [$(var)];
NEXT
EXIT SCRIPT;
Thank you for the reading.