Читать книгу QlikView Your Business - Troyansky Oleg - Страница 16

II
Learning the Core Techniques: Sales Analysis
Chapter 4
Visualizing Sales Analysis in QlikView
List Boxes, Text Objects, and Other Sheet Objects

Оглавление

Charts carry most of the weight in QlikView, but let’s first talk about simpler objects that create the proper environment for charts – list boxes that allow users to make selections; text objects that carry texts, images, and backgrounds; and a few other object types that are commonly used in most QlikView applications.

In this section, you will build the template that will be used throughout this application. The end result is presented in Figure 4-5. In the process, you will learn about the following QlikView objects:

● List boxes and multi boxes

● Table boxes

● Text objects

● Line/arrow objects

● Current selections box and search object

If you are familiar with the basics of QlikView visualizations, feel free to test your knowledge by building the template on your own. You may refer to the exercises in this section to get specific settings such as colors, positions, and sizes of various objects. Then, feel free to skip to the next section, called “Developing Simple Charts in QlikView.”


Figure 4-5: The end in mind – the finished Template sheet


Introducing List Boxes and Multi Boxes

List boxes and multi boxes serve a similar purpose in QlikView. They allow you to make selections and show selected, associated, and excluded values.

List Box: The Cornerstone of QlikView

List boxes present lists of field values and offer the ability to select certain items of interest. When certain data items are selected, their background turns green. Items that are associated with the selected values appear with the white background, and other items that are not associated are grayed out. The green-white-gray color scheme is one of the fundamentals of QlikView, and it’s implemented in list boxes.

Since list boxes are presenting fields (for the most part; you’ll see the exceptions later), they are also called “fields” presented on the sheet, and the list of those fields can be managed from the Sheet Properties on the Fields tab.

A list box can be created in two ways:

● A single list box can be created as any other sheet object can, by right-clicking on the screen and using the New Sheet Object option.One or more list boxes can be created in the Fields tab of the Sheet Properties, by selecting

● the desired fields from the list.

Since list boxes can be created simply by naming the corresponding fields, you can conclude that the only essential setting of a list box is the field that it represents. The rest of the settings are assigned by default (many of those defaults are stored in Document Properties and some are permanently defined in the tool).

Exercise 4.4: Creating List Boxes on the Template Sheet

1. Activate the Template sheet and open the Sheet Properties (right-click on the screen and select Properties).

2. Open the Fields tab and select four fields —Brand, Channel, Customer, and Style. Add the fields to the list of Fields Displayed in List Boxes using the Add button. You may add fields one by one, or select a group of fields by using Ctrl+Click.

3. Exit the Properties window. The four list boxes should be created in the upper-left corner of the screen. Grab them by the caption (click and hold the left mouse button) and drag across the screen to position them along the left side of the screen, approximately in the middle between the top and the bottom.

By default, most list boxes show a list of field values in a single column. Sometimes you’ll prefer to show values in multiple columns. For example, two-character state abbreviations are best displayed in a multi-column grid. In addition, year and month list boxes are traditionally displayed as single line boxes, positioned across the top of the screen. Those settings are defined in the List Box Properties, on the Presentation tab (see Figure 4-6).


Figure 4-6: List Box Properties, Presentation tab


Exercise 4.5: Creating Multi-Column List Boxes for Years and Months

1. Open Sheet Properties, select the Fields tab, and add two more fields —Year and Month.

2. Open the Object Properties (right-click the object and select Properties) for each one of the two new fields and configure the following:

a. Sort tab: Uncheck Sort byState. You want the years and months sorted chronologically, disregarding the selection state.

b. Presentation tab: Uncheck Single Column, uncheck Order by Column, check Cell Borders, and then center-align both Text and Numbers.

c. Layout tab: Set Border Width to 0 pts.

d. Caption tab: Uncheck Show Caption.

You may need to resize the list boxes in order to force all the values into a single line, as displayed on top of the screen in Figure 4-5. Moving objects with no captions is a bit tricky. You need to position your mouse precisely at the top of the object. Alternatively, you can hold the Alt key and drag the object, pointing at its center.

3. Save your work.

Multi Box: A Space-Saving Compromise

List boxes are great for displaying lists of values and unveiling associations between the selected items and other data fields. The only problem is they take a lot of valuable real estate on the screen. You might have more fields than you can fit on the screen, and the Multi Box is the solution for allowing more selections in a limited space.

In a multi box, multiple fields share the same object, and each field takes up a single line. The list of fields that should be displayed in a multi box is managed in the General tab (see Figure 4-7). Other than that, multi boxes share most of the common settings of the list box.


Figure 4-7: Multi Box Properties, General tab


Sizing multi boxes is not as easy as sizing list boxes. Like any other multi-column objects in QlikView, multi boxes can’t be stretched by dragging the edges of the object. Each column within a multi-column object needs to be resized individually. Hover over the columns until your pointer turns into a resizing symbol. Drag the columns to the left and to the right as needed.

In the next exercise, you create a multi box with additional fields that couldn’t be presented in individual list boxes.

Exercise 4.6: Creating a Multi Box

1. Right-click on the screen and select New Sheet Object⇒Multi Box.

2. Type Other Filters as the title of the object.

3. Select the following fields to be displayed in the multi box: Salesperson, Product Group, Product, Season, Size, and Color. Press OK to confirm all the changes.

4. Drag the new object across and position it on the left side of the screen, below the list boxes.

5. Save your work.

Table Box and How It Should (Not) Be Used

A Table Box is a simple object that shows a table of data values from multiple fields. For example, a table box with customer names, addresses, and phone numbers could serve as a short list of customers to call.

Table boxes are easy to configure. The desired fields are selected from a list of all fields on the General tab of the Table Box Properties (see Figure 4-8). At the same time, the usefulness of the table box is somewhat limited. Unlike the straight table chart, which you learn about later in this chapter, table boxes don’t allow you to aggregate the data. Table boxes are also known to perform poorly with large data sets, because they are not as good at memory management as the straight table chart.

Our recommendation is to use table boxes only for “quick and dirty” development needs, like data validation. At the same time, table boxes should not be used in any production applications. Even if you need to show a simple list of data items with no aggregation, a straight table chart with no expressions is a better choice, for its better performance. These comments will be clearer after we introduce the straight table chart later in this chapter. For now, just remember that table boxes are not the best choice for production use.


Figure 4-8: General properties of a table box


Using Text Objects for Labels, Images, and Backgrounds

Text Objects can play many roles in a QlikView application – they can carry simple texts and calculated texts, show images, or serve as a background for other objects.

In QlikView, all the text in the text object has to carry the same attributes – the same color, font, font size, and so on. In Chapter 16, you will see how it’s different in Qlik Sense, but for now you have to stick to the consistent formatting for the text within the text object.

Most of the important properties of the text box are defined in the General tab (see Figure 4-9). For most of the text boxes, it’s enough to enter the text and/or define the background. Horizontal and vertical alignment options help position the text and align it properly within the boundaries of the object.


Figure 4-9: General properties of a text object


For text objects that carry images, it’s important to choose the right Image Stretch option. When the object is sized differently than the original image size, this option will determine how the image should fill the size of the object. The most useful option that helps avoiding distortion of the image is Keep Aspect.

In the following exercise, you create and configure a number of text objects that are used in the Sales Analysis template.

Exercise 4.7: Creating Text Objects

A number of text objects need to be created for this template. Use Figure 4-5 as the visual guide.

1. Create a new text object that will carry the sheet title (Right-Click⇒New Sheet Object – you know the drill…).

a. Type Template in the Text box.

b. Make the Background fully transparent by sliding the Transparency slider fully to 100 %.

c. Fonts tab: Use Font Size 22, color RGB(0, 100, 200).

d. Layout tab: Set Border Width to 0 pt. Press OK to confirm.

e. Position the object on top of the screen, almost all the way to the left.

2. Create a new text object that will carry the icon next to the sheet title:

a. Leave the Text empty.

b. For the Background, use Image. Click on Change and find an icon image in the subfolder called \Icons. Pick an image of your choice. Under Image Stretch, pick Keep Aspect. Click OK to confirm the changes.

c. Position the image in the upper-left corner, to the left of the sheet heading.

3. Create a new text object that will carry the logo in the upper-right corner of the screen.

a. Leave the Text empty.

b. For the Background, use Image. Click on Change and find the logo image in the subfolder called \Icons. Alternatively, you can use any other logo of your choice. Under Image Stretch, pick Keep Aspect. Click OK to confirm the changes.

c. Position the image in the upper-right corner of the screen.

4. Create a new text object that will provide a gray ribbon outlining the header from the rest of the screen:

a. Leave the Text empty.

b. For the Background, use Color. Open the Color dialog and define the gray color as RGB(200, 200, 200).

c. Layout tab: Border Width=0, Layer – Bottom.

d. Caption tab: In order to ensure precise position of the object, enter the exact coordinates and sizes in the bottom-left corner: X-pos=0, Y-pos=41, Width=1,240, and Height=40. Click OK to confirm.

e. Ensure that the previous three text boxes fit nicely above the gray ribbon. Position the list boxes for Year and Month on top of the gray ribbon, approximately in the middle.

5. Create another gray text object, which will serve as the bottom outline of the page. It is very similar to the object created in Step 4, with the only difference in size and position. On the Caption tab, set X-pos=0, Y-pos=800, Width=1,240, and Height=6.

6. Save your work.

NOTE

This template is optimized to fit nicely in a screen with the resolution of 1280x1024. If you want to develop a template that works for a different screen size, tweak these suggested sizes and positions accordingly.

Line/Arrow Object

The name says it all – with this object, you can create lines or arrows on the screen, as a simple means of dividing the screen into sections. Figure 4-10 shows the General properties of the Line/Arrow object.


Figure 4-10: General properties of the Line/Arrow object


A line can be horizontal, vertical, or diagonal. You can set the Line Style, Line Weight, and Arrow Style properties, along with Color and Background Color properties, to define the look and feel of the line.

In most cases, the background color should be set to transparent to avoid overlapping with surrounding objects.

Pay attention to the exact size of the Line/Arrow object (Object Properties, Caption tab). The width of the object defines the length of the line (that is, for a horizontal line). The height appears to be unimportant; however, we recommend leaving it at the default setting (48 pts). Making line objects too narrow leads to visible distortions of the line, so it’s best not to make the size too narrow. Keeping the background transparent helps avoid any space issues.

In the following exercise, you add a thin vertical line to separate the list boxes from the charts.

Exercise 4.8: Adding a Vertical Line to the Template Sheet

1. Create a Line/Arrow object. Set the orientation to Vertical. Set the Arrow Style to be a straight line with no arrow heads.

2. Set the color to RGB(200, 200, 200).

3. Set the background color to fully transparent. Open the Color Area window and slide the Transparency slider all the way to 100 %.

4. Layout tab: Layer=Custom-5 (this will position the object below Bottom).

5. Caption tab: Enter the position and size manually. X-pos=250, Y-Pos=80, Width=48, and Height=705. Click OK to confirm.

6. Verify that the line connects between the two gray ribbons with no gaps and no overlap. Adjust as needed.

7. Resize and reposition the three list boxes and the multi box to fit nicely on the left of the new line. You set the width and the exact position of these objects later in this chapter.

8. Save your work.

Mind Your Selections: Search Object and Current Selections Box

Search Object and Current Selections Box are two commonly used objects. We recommend adding them to every analytical application and finding a prominent place for them in your document templates.

Search Object

The Search object is extremely useful and is easy to configure. It provides users with convenient Google-style search capabilities across multiple fields in the data set. It is especially useful when the user is not sure where to look for certain text. For example, you might have an order number, but you're not sure if it's an original order number, or the customer's order number, or some sort of a reference order number. Typing the number in the search box will reveal a short list of fields that contain the desired text. Then you can make the selection in the field of your choice.

Configuring a search object is extremely simple. In the General tab (see Figure 4-11), you can decide if you want to allow search across all fields, provide a list of fields, or manually pick selected fields to be allowed in the search.


Figure 4-11: General properties of the search object


All Fields is the quickest and the easiest setting, but the search may get confusing in a large application with many fields and cryptic codes that the users may not understand.

The List of Fields uses a semicolon as a separator and can include wildcards. For example, entering Customer* will lead to including all the fields that begin with the word Customer, while entering *Name will lead to including all the fields that end with the word Name.

Selected Fields may not be as flexible, but in many cases it is the preferred method, due to its simplicity.

In the Presentation tab, a few interesting settings are available. For example, you can choose the shape of the search object as rounded or squared.

In the following exercise, you add a Search Object to the Template sheet.

Exercise 4.9: Adding a Search Object to the Template Sheet

1. Add a new Search Object. Allow the search in All Fields.

2. Presentation tab: Make sure that the appearance is set to Squared.

3. Layout tab: Make sure that the Layer is set to Normal or Top. Click OK to confirm.

4. Position the Search Object on the right side of the gray ribbon. Move Year and Month to the left if needed. Use Figure 4-5 as a visual guide.

5. Save your work.

Current Selections Box

The Current Selections box allows users to see the current selections. Since all the numbers on the screen are only relevant in the context of the currently selected items, it’s extremely important to know what data is selected. In a way, this is a version of the “You Are Here” sign on a tourist map.

Because of its importance, the Current Selections box should be present in a prominent place in most analytical applications – most commonly in the upper-left corner of the screen, above the list boxes.

The Current Selections box comes predefined with several presentation settings. In most cases, it’s good enough to create the object and accept all the defaults.

The Current Selections box consists of three columns with invisible, yet existing, boundaries – Fields, Field Values, and special Icons between them. Each currently selected field will be listed with the corresponding list of values, and the icons allow clearing or modifying the selection. An additional icon, not included by default, allows you to lock and unlock selections from the Current Selections box, which is less common.

Resizing the Current Selections box is a bit tricky. It’s easy to make the object wider. In order to make it narrower and to avoid the horizontal scrollbar, you need to resize the three columns individually. The process is similar to resizing individual columns in a multi box. However, in the Current Selections box, you should resize the columns from the top of the column. Dragging the boundaries in the middle of the object doesn’t lead to the same effect.

In the next exercise, you add a Current Selections box to the template.

Exercise 4.10: Adding a Current Selections Box

1. Create a new Current Selections Box. Accept all the defaults and click OK.

2. Position the new object in the upper-left corner, just below the gray ribbon and above the list boxes, as it appears in Figure 4-5. Resize the object as needed to fit nicely in the available space.

3. Save your work.

Organizing and Arranging Objects on the Screen

Now is the time to bring it all together and arrange all the objects neatly on the screen. In this section, you learn everything about moving, arranging, and copying objects in QlikView. You also arrange all the objects on the Template screen in a neat organized way, ready for prime time.

Moving and Positioning QlikView Objects On the Screen

The most basic way QlikView objects can be moved around and repositioned on the screen is simply by dragging the Caption bar of the desired object to a new location. Objects without a Caption bar (Year and Month, for example) can be moved by holding the Alt key and dragging the object using its center area.

With a sufficient amount of hand-eye coordination, objects can be dragged to their desired locations and aligned manually. However, professional-looking applications require precise placement of objects.

Get a Mouse!

Our sincere advice to all laptop users – get a mouse! Unless you are a die-hard trackpad expert, you will discover that moving, cloning, and resizing objects involves a lot of dragging and dropping, which can be done much more comfortably with a mouse rather than a trackpad.

When multiple objects are presented on the screen, they should be properly aligned, forming visible horizontal and vertical lines. Our eyes are looking for a sense of order and structure, and if we can’t find a well organized set of vertical and horizontal lines, we perceive the presentation as sloppy and unprofessional. For this reason, it’s extremely important to keep multiple objects on the screen well aligned and similarly sized. The following techniques can help you get pixel-perfect control over an object’s position and alignment:

● Move an object using keyboard shortcuts. Pressing Ctrl and one of the arrow keys will result in moving the object a single pixel at a time. Pressing Ctrl+Shift+Arrow will move the object 10 pixels at a time.

● Specify the exact pixel position and enter itmanually in the Caption tab of the Object Propertieswindow.

● In order to position a group of objects in a consistent way, use a set of object alignment tools, which you learn about in the next section.

Aligning Multiple Objects

QlikView offers a nice set of alignment tools that become available as soon as multiple objects are activated. Objects can be activated either by clicking the Caption bars of multiple objects one by one while holding the Shift key, or by “lassoing” a group of objects with the mouse. When lassoing, the objects need to be covered by the “lasso” completely, or they won’t be included in the multiple selection.

When working on moving, aligning, and resizing objects, it can be helpful to turn on the Design Grid. The Design Grid is a helper tool that shows a grid on the screen, helping to snap objects into place. When the Design Grid is on, active objects are outlined with a visible frame with eight “handles.” The frames let you see how much space is allocated for each object. The handles can be used to resize the object vertically, horizontally, and diagonally. In the process of “lassoing” multiple objects, the frames around the active objects help you verify what objects were in fact activated. The Design Grid can be turned on from the View menu, or using the corresponding icon on the Design toolbar, or with the keyboard shortcut Ctrl+G. See Figure 4-12.


Figure 4-12: Design toolbar


Once the desired group of objects is activated, you can align them in a variety of ways – align to top, bottom, left, right, or center. You can also distribute the objects in a couple of ways – in a tight line with a few pixels between objects (Adjust), or by distributing the available space between the first and the last object in the group (Space). Alignment tools can be accessed by right-clicking the group of selected objects and selecting one of the alignment icons from the context menu. The same icons are available in the Layout menu and on the Design toolbar. See Figure 4-12.

In the following exercise, you will align all the template objects and make the screen look nicely organized.

Exercise 4.11: Aligning the Template Objects

1. Turn on the Design Grid to make it easier to see object sizes.

2. Lasso the three text objects on top of the screen – the icon, the heading, and the logo. Right-click and select Center Vertically.

3. Lasso the gray ribbon and the three objects located on top of it, and also center them vertically. Make sure that the list boxes and the search object have approximately equal height. You may have to resize the search object for that.

4. Select all the list boxes, the multi box, and the Current Selections box (use Shift-Click to select multiple objects). Right-click and select Align Left. Right-click again and select Adjust Top. Resize objects as necessary to fit them nicely together and to ensure that they are aligned on the left and right. Note that when multiple objects are selected, they all get resized together, except for the multi box. If you recall, you have to resize individual columns within the multi box in order to resize the object.

5. Save your work.

Cloning Sheet Objects

There are a number of ways to clone sheet objects in QlikView. Feel free to practice all of them and pick your favorite:

● Right-click on the object and select Clone from the context menu. The new object will be created slightly below the source object. You can reposition the new object by dragging it to the new location with your mouse, holding it by the Caption bar.

● You can also clone an object by dragging it while pressing the Ctrl key. The new object will be created in the new location while you release the mouse key.

This method also allows moving and copying objects between sheets. Dragging the object and dropping it on the other sheet’s tab allows moving the object. The same movement combined with pressing the Ctrl key results in cloning the object and placing the new clone in the new tab.

● Right-click on the object, select Copy to Clipboard⇒Object, and then paste it anywhere on the same sheet or on another sheet, or even in another document. Yes, that’s right. QlikView objects can be copied between documents. As long as the same data fields exist in both documents, the copied object will function the same way in a different QlikView application.

● Lastly, if you prefer good ol’ keyboard shortcuts Ctrl+C and Ctrl+V, those will work too. Just make sure to activate the desired object by clicking on it. Similarly, to copy and paste all the objects on a given sheet, use the combination of shortcuts Ctrl+A (Select All), Ctrl+C (Copy), and then Ctrl+V (Paste) on the new sheet.

Cloning Sheets and Pasting Objects as Links

In the previous section, you finished building the Template sheet. Having the main outline of a page saved in a Template sheet helps create new sheets with a consistent set of common objects.

For that matter, you need an easy and effective way of cloning the contents of the whole sheet. You can copy all objects and paste them on the new sheet, but there are better ways.

One way is to copy the sheet by right-clicking anywhere on the sheet and selecting Copy Sheet from the menu. A new sheet will be created with exact copies of all objects.

The new objects that are created are going to repeat all the settings of the old objects, but they are individual objects, not linked in any way to their originals. That means that if you need to make any changes to your common objects (assign another color or font, or modify a border), these changes will have to be propagated manually in all copies of the same object on different sheets.

QlikView offers a better alternative for objects that need to be repeated many times. Objects can be copied and pasted as links. This way, the objects remain linked and share the same set of properties. Now, a change in one of the objects will affect all the linked objects at once.

Different instances of linked objects may have different positions on different screens. However, it’s common to reposition the object in the template and to want all linked objects to follow the same position. For this purpose, linked objects offer a special menu option in the right-click context menu – Linked Objects ⇒ Adjust Position of Linked Objects. This way, all linked objects can be positioned identically.

The process of creating linked objects is somewhat similar to the regular process of copy and paste. The only difference is that this kind of paste cannot be performed with the Paste command or with Ctrl+V. Instead, you right-click on the desired sheet and select Paste Sheet Object as Link. Alternatively, you can drag and drop objects while holding Ctrl+Shift to create linked objects.

For the purpose of cloning template objects, using the Copy and Paste Objects as Link options is preferable to the simple Copy Sheet, for easier maintenance.

Notice that once the linked objects are created at least once, Copy Sheet will produce the desired result as well. Since all the common objects are already identified as linked objects, the new sheet will contain new instances of the same linked objects.

In the following exercise, you create linked objects for all template objects and then clone the Template sheet to create two more sheets.

Exercise 4.12: Cloning Common Objects as Linked Objects

1. Activate all objects on the Template sheet (Ctrl+A) and copy them (Ctrl+C).

2. Open the sheet called Sales. Right-click it and select Paste Sheet Object as Link.

3. IMPORTANT! Sheet title and sheet icon need to be different on every sheet. For this reason, these two objects on top of the sheet need to remain unlinked. Right-click the text object with the sheet title Template and select Link Object⇒Unlink This Object. Repeat for the text object that carries the icon in the upper-left corner.

4. Use Copy Sheet to clone the Sales sheet and create two more sheets named Trends and Reports.

Voila! The application is now ready for the main analytical part – adding charts.

QlikView Your Business

Подняться наверх