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

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
coleturegroup
Creator
Creator

Qlik Sense: How do we prepare script using the Store statement to save data with a QVS extension to a defined data connection on the server?

The documentation is not very clear on this specific request.

Creating QVS files

Create QVS files in a text editor outside of Qlik Cloud. Load script history can also be downloaded as QVS files.

Do the following:

  1. Create a block of load script in an app or script.

    Creating your load script in an app or script allows you to test the script first before adding it to a QVS file.

    Alternatively, find a block of load script you want to reuse.

  2. In a text editor, copy and paste the block of load script you want to reuse.

  3. Save the load script as a file with the QVS extension.

You can now upload the QVS file to Qlik Cloud or a web storage provider.

Example:

The App will consume the data daily needed in the proper script format then store it to a data connection.

For Example: 

 Comment Field [Field1]   With "Dimension | A note that describes field contents ";

Store QVS_1 into [lib://QVS_Files/Automation/Generate_Data.qvs]) (txt,delimiter is ';');

Then all Apps that need to load this script daily via:  Must_Include statement. 

What am I missing here?

Labels (4)
2 Solutions

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

"storing a file type of QVS it wouldn't apply header information"

If you use the Mapping technique, the generate header is a good thing. I don't understand why you would pursue the Must_Include solution. Is there App specific script in this file?

-Rob

View solution in original post

marcus_sommer

It's a misinterpretation that a qvs-file is mandatory a pure Qlik script - else it's just a file-extension for a txt-file. Because of the fact that Qlik used quite old windows libraries for this feature there aren't many customizing options like enabling/disabling header and/or quote-handling ... 

Nevertheless these files could be applied as direct script - if they are appropriate prepared. This means the rows must contain valid code like:

set var = abc;

mostly created by concatenating the wanted content before assigning them to a rows/columns. This includes also the header which might be set to:

REM abc;

It becomes more difficult if there are any quotes includes because it will lead to an extra wrapping quoting but with some efforts and advanced scripting to include further quotes and comments it should be possible to create longer and complex scripts.

Like already hinted from Rob there are surely more simple ways - from a technically point of view as well as from an administrative one especially if a centralized logic should be applied. It's easily done with a mapping - and such mapping might be applied per include-variables.

And such includes-variables may contain other includes which also contain includes ... respectively they could be nested with any conditions. This could lead to a complete automation for scripts with a starting- and ending include-variable which control per layer + path + name which interpretation variables, connections ... and cleaning ... 

View solution in original post

11 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think the documentation you posted is not very clear (can you post a web source link?).

You create qvs file using a text editor. And then upload them to a data connection location.  You would not typically use a script Store statement to create QVS files. 

-Rob

coleturegroup
Creator
Creator
Author

So I’m creating the QVS file in a alike sense App and storing the data
table as a QVS file using the store command shown



Thank you

Walter Coleman

Integration, Visualization Architect, Advanced Analytics, Insights

Qlikview/Qlik Sense

Office #: (631) 885-4380

u niversalwxc@gmail.com
coleturegroup
Creator
Creator
Author

We are automating the field definitions across all published App in the system. With that understanding, I understand your thought here Rob if it were just a single QVS, We have over 200 Apps that field definitions are required. This automation App collects all fields across all Apps and prepares QVS files to store each Apps Comment field definitions and captures any updates made daily. we structured the maintenance Apps script to create: in this example the comment field script entry, and store daily updates since Apps add and modify fields in all the published Apps possible daily, in the example given, It structures it's output correctly so that we eliminate the manual effort in creating and updating the QVS file so that each published App can do a (Must_Include) so that its field definitions are visually correct across App.

Hope this helps

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I understand. You can build the script statements as a table in your script but the store statement will insist on including a header line and quoting commas and such, making the file unusable as script.

If your statements are Comments and Rename Fields you might find it easier to use Mapping. This is the way I maintain these types of Defs in a single file shared by all Apps. 

For example a csv file names MasterComments that looks like this:

Field, Comment
Field1, Dimension | A note that describes field contents 
Company, The parent company name


Then each app loads the file and applies the comments like:


CommentMap:
Mapping Load Field, Comment 
from [lib://datafiles/MasterComments.csv]...;
Comment Fields using CommentMap;

https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularS...

Would that work for your use case? 

-Rob

coleturegroup
Creator
Creator
Author

Sorry, it seems like that doesn't take into consideration using a Must_Include in all Apps holding each comment field section of the script to effect all changes automatically. 

If I understand you correctly, saving as a qvs file still mandates a header of some sort if using the Qlik Store function. I thought QVS just read in the script as it was copied out of the script editor? Seems like a hole that needs filling since QVS files operate differently translating as script.

So your also telling me I need to create 200+ QVS files using notepad and store them on the file system and manually update each QVS file in order to capture updates as changes happen?

Still confused, give me a bit and I'll try your solution, 

Thanks Rob

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

"still mandates a header of some sort if using the Qlik Store function"

Yes, that is a limitation of the STORE command. It wasn't really designed to create an unmodified text file. 

"...need to create 200+ QVS files using notepad and store them..."

If you are just dealing with "COMMENT" commands,  you don't need a separate file for each app. You can have one master Comment file, whether you use Must_Include or the Mapping technique. It does not cause an error in either technique to COMMENT a field that does not exist in the app.

Do you have App specific code that you need to include in this QVS?

-Rob

marcus_sommer

A small addition to the suggestion from Rob - the mapping-source may also contain a target-information which is queried as filter, like:

m: mapping load Field, Comment from X where Target = documentname();

which would avoid an overlapping between the apps for common fields like Date or Name which may have a different meaning.

coleturegroup
Creator
Creator
Author

Thanks Rob for your patience, I have a master App that pulls all Apps (200+) and generates the comment field entry for every App/field in the system that we copy and paste in each of our Apps. Seems like a waste of energy FTE wise. Qlik gathers and separates it in seconds. I had hoped that when storing a file type of QVS it wouldn't apply header information. Figures.... I'll keep trying to find a way around the work effort needed to standardize definitions across Apps. Must_Include is the answer only how to cut the manual effort needs to be addressed... 

Also, where is the file that controls the region settings so I can add a few lines of script?

 

 

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

"storing a file type of QVS it wouldn't apply header information"

If you use the Mapping technique, the generate header is a good thing. I don't understand why you would pursue the Must_Include solution. Is there App specific script in this file?

-Rob