Databases Reference
In-Depth Information
Standardizing and organizing script
Have you ever experienced the following situation? A challenging problem
presents itself. After many hours of thinking, developing, thinking some more, and
developing some more, you have crafted a solution. "This is brilliant work!" you say
to yourself, "It completely solves the problem, and in a very elegant way too."
Fast-forward a few months. A new business question presents itself and a small
change to your original solution is required. You look at your original work, and
after some poking around decide that you can make neither head nor tail of it."This
is horrible work!" you say to yourself, "What was I thinking at the time?".
Did your script really go from brilliant to rubbish over the course of 6 months?
Most likely not. You have just lost familiarity with the script. Fortunately, there
are ways to ensure that you (and others) are able to quickly get up to speed when
modifying existing QlikView script. The secrets are organizing your scripts and
using naming conventions.
Using tabs
As we saw when we first looked at the script editor, the script can be split up into
different tabs. It is advisable to divide your script into different tabs, each one
focusing on a different functional area or table.
To add a tab, select Tab | Add Tab from the menu or click the Add new tab button
on the toolbar. Tabs can be moved left and right by selecting Tab | Promote and Tab
| Demote respectively, or by clicking the corresponding buttons on the toolbar.
Let's organize our script by opening the script editor and following these steps:
1.
Select Tab | Add Tab from the menu.
2.
Name the tab Mapping and click on OK to close the Tab Rename window.
3.
Promote the Mapping tab so that it is in front of the Main Data tab.
4.
Move all MAPPING LOAD statements ( Map_Manufacturer_Country , Map_
Table_Comments , and Map_Field_Comments ) from the Aircrafts tab to the
Mapping tab.
5.
Create a new tab by clicking on the Add new tab button on the toolbar.
6.
Name the tab Comments and click on OK to close the Tab Rename window.
7.
Promote the Comments tab so that it is in front of the Main Data tab.
8.
Move all COMMENT statements from the Aircrafts tab to the Comments tab.
9.
Save the document.
 
Search WWH ::




Custom Search