{"id":12162,"date":"2019-09-10T14:49:55","date_gmt":"2019-09-10T12:49:55","guid":{"rendered":"http:\/\/datalabsua.com\/?p=12162"},"modified":"2020-09-22T13:37:51","modified_gmt":"2020-09-22T10:37:51","slug":"handy-tips-for-qlik","status":"publish","type":"post","link":"https:\/\/datalabsua.com\/en\/handy-tips-for-qlik\/","title":{"rendered":"Handy tips and tricks for Qlik"},"content":{"rendered":"<p>Qlik is one of the leading providers of business intelligence and data visualization solutions on the global market. More than 48,000 organizations use QlikView and Qlik Sense products &#8211; an impressive figure, but one that makes you think.<\/p>\n<p>How many users from all these companies are really able to get the most out of QlikView and Qlik Sense capabilities?<\/p>\n<p>We have prepared a few tips and tricks that will optimize your work when designing and developing applications based on QlikView and Qlik Sense. In general, they apply to both products, but some are only for QlikView. This will be indicated in each section. A number of tricks are exclusively technical, others will come in handy when creating any objects.<\/p>\n<p>This article will be useful for a beginner, while a versed developer can test their knowledge.<\/p>\n<p><strong>1. Commenting in the script<\/strong><\/p>\n<p>Comments in scripts allow other people to understand what is going on. This does not mean you need to comment on each process. It is enough to add a comment where you encounter any difficulty or find an alternative solution that needs clarification. Comments are also convenient if you need to return to the code that you did a month or even several years ago and quickly parse it.<\/p>\n<p>Leaving a comment on a line does not require much effort &#8211; just add \/\/ at the beginning or use the shortcut Ctrl + K + C. To uncomment a line, press Ctrl + K + U.<\/p>\n<p><strong>2. Take advantage of the script editor<\/strong><\/p>\n<p>If you do not want to run a part of the script for one reason or another (for example, it creates problems in the application), you can comment out it.<\/p>\n<p>To do this, select text in QlikView and right-click. In the context menu, select \u201cComment\u201d or \u201cUncomment\u201d.<\/p>\n<p>In Qlik Sense, you need to select the text, and then click on the comment icon.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12175\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/comment-line.png\" alt=\"\" width=\"700\" height=\"197\" \/><\/p>\n<p>To comment out the entire section of the script, place the appropriate markers at the beginning and at the end of the section:<\/p>\n<p>\/ * marks the beginning of a commented section.<\/p>\n<p>* \/ marks the end of the commented section.<\/p>\n<p>It looks like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12174\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/comment-section.jpg\" alt=\"\" width=\"400\" height=\"118\" \/><\/p>\n<p>Additionally, to make the code readable, you can align the selected lines of the script using the Tab key or the Shift + Tab combination.<\/p>\n<p><strong>3. Write code faster<\/strong><\/p>\n<p>Macros will help speed up work in the QlikView script editor. To get hints for them, use the combination Ctrl + Q, S, C (CTRL + Qlikview ShortCut) while in the editor. It will open a window with all the keyboard shortcuts.<\/p>\n<p><strong>4. Backus-Naur uniform<\/strong><\/p>\n<p>The syntax of the QlikView command line and scripts are described in a notation called Backus-Naur Form (BNF). It is one of the metalanguages \u200b\u200bused to describe programming languages \u200b\u200bin order to standardize them. Defining a clear language structure is very important for it to be correctly converted to machine language during script execution.<\/p>\n<p>To see the BNF code syntax, in the QlikView script editor, press CTRL + Q + B + N + F.<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12178\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/bnf-3.png\" alt=\"\" width=\"600\" height=\"185\" \/><\/strong><strong>5. Plan your escape<\/strong><\/p>\n<p>If you have a complex script that needs to be debugged at some point, don&#8217;t panic.<\/p>\n<p>A great way to take control of this process is to create a tab with the \u201cEXIT SCRIPT\u201d command. Moving it among other tabs, you choose exactly when you want to complete the script.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12172\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/exit.jpg\" alt=\"\" width=\"400\" height=\"103\" \/><\/p>\n<p>After debugging, be sure to remove the tab.<\/p>\n<p><strong>6. Get rid of everything you no longer need<\/strong><\/p>\n<p>Temporary objects must exist temporarily. That is why after carrying out the necessary calculations and transformations, temporary tables or fields must be deleted.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12171\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/drop-table.jpg\" alt=\"\" width=\"400\" height=\"292\" \/><\/p>\n<p>Thus, not only do you free up memory, but also avoid synthetic keys and loops, which negatively affect the data model and disrupt the display of data in dashboards.<\/p>\n<p>To prevent such problems, develop two habits.<\/p>\n<p>First, check all the messages that you receive after the completion of the script. They may contain information about the existence of circular references, which must be eliminated in time.<\/p>\n<p>Secondly, upon the outcome of data loading, verify using the system fields that the loaded tables do not contain temporary keys. If they are found, remove them immediately.<\/p>\n<p>Having developed this routine, you will ensure there won\u2019t be any unpleasant \u201csurprises\u201d in the future.<\/p>\n<p><strong>7. Limit the load<\/strong><\/p>\n<p>If you need to debug a table with a lot of rows or containing complex joins, you do not need to load all the records.<\/p>\n<p>After launching debugging mode on the quick access panel, you can specify in the opened window the number of records you want to download. The First prefix to the LOAD statement solves this problem as well.<\/p>\n<p>This can also be done in Qlik Sense, as shown below:<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12170\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/debug-load.jpg\" alt=\"\" width=\"700\" height=\"298\" \/><\/strong><strong>8. Usefulness of the third ApplyMap parameter<\/strong><\/p>\n<p>Mapping tables greatly simplify the life of the developer when working with scripts in QlikView and Qlik Sense. With their help, you can find a single value in another table and replace the field values \u200b\u200bduring script execution without loading unnecessary data.<\/p>\n<p>Using the third parameter of the ApplyMap function, you can find values \u200b\u200bthat you may have missed. The function returns them if they were not found in the table.<\/p>\n<p>For example, try ApplyMap (\u2018MyMappingTable\u2019, LookUpField, \u2018No match\u2019).<\/p>\n<p>Look for the value \u201cNo match\u201d or \u201cNA\u201d in this field to identify gaps in the matched data.<\/p>\n<p><strong>9. Guaranteed error detection<\/strong><\/p>\n<p>When working with include files, using the $(Include) command is not worthwhile, because if the include file is not found, you will not receive an error message.<\/p>\n<p>In this case, it is better to use $ (Must_Include), which is guaranteed to cause an error message if the include file is not found.<\/p>\n<p><strong>10. Table Viewer \/ Data Models Viewer is your indispensable helper.<\/strong><\/p>\n<p>We have already mentioned that by using system fields you can detect temporary tables and circular references. You will achieve the same result using the Table Viewer function.<\/p>\n<p>Moreover, Table Viewer in QlikView and Data Model Viewer in Qlik Sense are especially helpful when you add tables or make changes to the links between them.<\/p>\n<p>These tools will help find incorrect joins, synthetic keys, and randomly created island tables before they cause data inconsistencies.<\/p>\n<p><strong>11. If is not always the best solution.<\/strong><\/p>\n<p>Having diagrams and table expressions that contain a huge amount of data, it is better to refrain from using the if statement. If () processes data line-by-line, which as a result may slow down your applications.<\/p>\n<p>In this case, Set Analysis will help achieve better performance. The ability to use it is essential for effective work in QlikView and Qlik Sense, since set analysis is one of the foundations for creating dashboards. It will facilitate your work if you need to compare different time periods or create selections that are different from the general data set.<\/p>\n<p><strong>12. Detect locked files<\/strong><\/p>\n<p>In the case of an odd QlikView reload, when you know for sure the script does not cause this problem, pay attention to the QVD files and logs.<\/p>\n<p>Under some circumstances, one of these files can be locked. As a result, you see an error in the LOAD statement, as well as when you try to reboot the system.<\/p>\n<p>In this situation, close all instances of QlikView Desktop and try launching it again.<\/p>\n<p><strong>13. A sudden reboot? No problems!<\/strong><\/p>\n<p>For everyone who spends a lot of time creating a good project, it\u2019s a huge tragedy to lose it due to some error in the application. Fortunately, QlikView has a useful option that allows you to save a document before reloading.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12169\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/save-b4-reload.jpg\" alt=\"\" width=\"700\" height=\"153\" \/><\/p>\n<p>Thanks to it, you do not need to worry about the safety of your report, when one small error leads to big troubles in the script.<\/p>\n<p><strong>14. No need for data<\/strong><\/p>\n<p>In QlikView and Qlik Sense it\u2019s possible to launch a recently opened application without data.<\/p>\n<p>This will come in handy when your application holds a large amount of data or you inadvertently created a monster with poor joins.<\/p>\n<p>To do this, in QlikView, click on the &#8220;Home Page&#8221;, then on &#8220;Recently Opened Documents&#8221; and, having selected the desired document from the list, right-click and select &#8220;Open without data&#8221;.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12168\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/open-wo-data.jpg\" alt=\"\" width=\"700\" height=\"136\" \/><\/p>\n<p>In Qlik Sense, you just need to right-click on the application in the hub and select &#8220;Open without data.&#8221;<\/p>\n<p><strong>15. Saving data from temporary tables<\/strong><\/p>\n<p>Sometimes we rely on temporary tables to process the data again or store them separately before they are combined. Of course, at the end of the script, they are gone.<\/p>\n<p>Debugging problems in such tables may seem difficult, but there is a solution. You can store them into a QVD file using the STORE command. This way you can save all data after a reboot. Then you can view QVD files with EasyQlik QViewer.<\/p>\n<p><strong>16. Scaffolding<\/strong><\/p>\n<p>When working with new data, try using the QUALIFY * command at the beginning of the script when loading tables from the source. This will keep the tables separated until you decide which key fields are needed.<\/p>\n<p>Presenting data in the form of table blocks greatly simplifies the initial stage of work. After that, you can easily move on to charts and straight or pivot tables.<\/p>\n<p>Some experts call this method \u201cscaffolding\u201d &#8211; the frame (table blocks) disappears as soon as a permanent structure takes shape.<\/p>\n<p><strong>17. Unified calendar<\/strong><\/p>\n<p>QlikView and Qlik Sense developers often deal with certain dates in the application (financial periods, time ranges, and much more). To organize the workflow and avoid confusion, use the master calendar.<\/p>\n<p>Make it a rule to attach the data in the application to one calendar, avoiding multiple data selections. Otherwise, you run the risk of confusing the user and complicating your work while maintaining separation.<\/p>\n<p>Speaking about the organization of work &#8230;<\/p>\n<p><strong>18. Store information in one place<\/strong><\/p>\n<p>We often must work with data from different systems. Naturally, each system has a fact table incorporating dates and a series of dimensions.<\/p>\n<p>To steer clear of potential chaos in the QlikView and Qlik Sense associative models, gather all the data in one table. This will help simplify joins and generally works efficiently.<\/p>\n<p>Important! Before combining, make sure that the aggregated fields have different names so that the data does not suddenly mix.<\/p>\n<p><strong>19. Copy the colors &#8230;<\/strong><\/p>\n<p>Another convenient option in QlikView is ability to copy color from any source. This also applies to copying colors from an expression where they are selected using logic.<\/p>\n<p>You just need to right-click on the color field and select &#8220;Copy.&#8221; Having decided on your destination, select &#8220;Paste All&#8221; and you&#8217;re done!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12167\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/copy-colour.jpg\" alt=\"\" width=\"300\" height=\"173\" \/><strong>20. &#8230; and even expressions!<\/strong><\/p>\n<p>In QlikView, among other things, you can copy expressions from one object to another. Moreover, you are not just copying text, but all formatting, including colors, text formatting, etc.<\/p>\n<p>As before, use the right click to copy and paste as the need arises.<\/p>\n<p><strong>21. Gone! Or not?..<\/strong><\/p>\n<p>While we\u2019re on the subject of QlikView, it\u2019s worth mentioning the developer can use the &#8220;conditional show&#8221; feature to hide certain objects and sheets until they need to be displayed.<\/p>\n<p>Very convenient, but if you make a mistake in the logical condition, you can say goodbye to them.<\/p>\n<p>In this case, do not despair. To restore them, follow these steps for the sheets:<\/p>\n<p>Document Properties> Sheets<\/p>\n<p data-wp-editing=\"1\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12166\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/restore-sheets.jpg\" alt=\"\" width=\"700\" height=\"267\" \/><\/p>\n<p>To restore objects:<\/p>\n<p>Sheet Properties> Objects<strong><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12165\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/restore-objects.jpg\" alt=\"\" width=\"700\" height=\"531\" \/><\/strong><\/p>\n<p><strong>22. Qlik Community as a platform for collaborative problem solving<\/strong><\/p>\n<p>Faced with a problem in QlikView or Qlik Sense, look for a solution on the Qlik forum. Surely you are not the first to go through this. If not, you can ask a question and people will gladly help you.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12179\" src=\"https:\/\/datalabsua.com\/wp-content\/uploads\/2020\/09\/qlik-forum.jpg\" alt=\"\" width=\"700\" height=\"186\" \/><\/p>\n<p>In addition, do not forget about the similarity of the scripting language and functions in QlikView and Qlik Sense. Solutions for each of them are useful in most cases.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>More than 48,000 organizations use QlikView and Qlik Sense products &#8211; an impressive figure, but one that makes you think. How many users from all these companies are really able to get the most out of QlikView and Qlik Sense capabilities?<\/p>\n","protected":false},"author":1,"featured_media":41687,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[18,22,23],"class_list":["post-12162","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-performance-improvement","tag-qlik","tag-recommendations"],"_links":{"self":[{"href":"https:\/\/datalabsua.com\/en\/wp-json\/wp\/v2\/posts\/12162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/datalabsua.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/datalabsua.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/datalabsua.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/datalabsua.com\/en\/wp-json\/wp\/v2\/comments?post=12162"}],"version-history":[{"count":1,"href":"https:\/\/datalabsua.com\/en\/wp-json\/wp\/v2\/posts\/12162\/revisions"}],"predecessor-version":[{"id":42853,"href":"https:\/\/datalabsua.com\/en\/wp-json\/wp\/v2\/posts\/12162\/revisions\/42853"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/datalabsua.com\/en\/wp-json\/wp\/v2\/media\/41687"}],"wp:attachment":[{"href":"https:\/\/datalabsua.com\/en\/wp-json\/wp\/v2\/media?parent=12162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/datalabsua.com\/en\/wp-json\/wp\/v2\/categories?post=12162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/datalabsua.com\/en\/wp-json\/wp\/v2\/tags?post=12162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}