QlikView – How to duplicate expressions groups

I would like to share with you how to duplicate expressions groups (a long-awaited feature). Using this method you can also duplicate also dimensions groups or set properties to all objects in all your projects in one step.

Exciting, right?

Here we go!

1) Open QlikView -> New project -> Edit script -> Press CTRL+Q twice to generate a demo script -> Save as “Duplicate.qvw” -> Reload document

2) Right click on the sheet -> New chart -> Press Next to go to “Dimensions” tab -> Add “Dim1” to used dimensions -> Press “Next” to go to “Expressions” tab -> Add 3 expressions and group them

 

Image

 

3) Click “Finish” and save the document

4) Create a new folder in the same place as your document and give it the same name and add “-prj” at the end. In our case, we have “D:\Projects\Duplicate.qvw” so we create a new folder “D:\Projects\Duplicate-prj”

5) Save the document again. QlikView is actually looking for this folder when saving and loading documents as this is a part of the versioning procedure. So, when saving the document, QlikView will populate it with XML definitions of all the objects. When loading documents, QlikView will automatically update the objects with the info from those XML files.

Now you can close QlikView.

6) Locate the “CH01.xml” file in the new project folder we created and open it with Notepad++ (or any tool you use). This is the file that contains the definitions of our chart because it has the chart ID as name. 

We collapse al the properties to get a better view of the structure and this is what we see:

Image

 

We see that under<Expressions> there is an <ArrayOfMainExpressionData> with our three expressions in it. Bingo! This is our group of expressions and all we have to do is to duplicate that:

Image

 

7) Save the xml file and open our QlikView document. Done!

Now we see that we have two groups of expressions in our chart:

Image

 

Making changes in the definition xml files using a search and replace tool can help a QlikView developer to become more productive and to enforce design rules to all the objects in all the documents.

If you want to duplicate the dimensions groups, they are located in AllProperties.xml file.

Happy Qliking!

Advertisements
Tagged with: , ,
Posted in Articles
2 comments on “QlikView – How to duplicate expressions groups
  1. Dave says:

    Hi Lucian
    I tried this and found it to be very powerful.
    Only problem is that once I made change to chart xml file and those changes were reflected in the chart, I could no longer access the properties of the chart from within the app. The properties menu option on right-click was not visible.
    regards
    Dave

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: