QUERY STUDIO HOW-TO GUIDE Preparedby Leah Targon
Contents Contents... 1 Logging on to the Information Warehouse... 2 Launching Query Studio... 4 Working in Query Studio... 5 New Report Window... 5 Using the Back and Return Buttons... 5 The Standard Toolbar... 6 The Style Toolbar... 8 Data Menu... 9 Creating Simple Reports... 12 Selecting Fields for your Report... 13 Adding a Title to your Report... 14 Saving a Report... 15 Sharing a Report... 16 Creating Sections... 18 Summarizing Data... 19 Changing Summary Values... 20 Formatting Data... 22 Using the Undo/Redo Buttons... 25 Sorting... 26 Adding a Filter to your Report... 28 Adding a Prompt to your Filter... 29 Running your Report with a Prompt... 31 Viewing your Report... 32 Creating Groups... 33 Creating a Calculated Field... 35 Creating a Second Calculated Field... 37 Report Format Options... 39 Excel Report Format... 41 Creating a Crosstab Report... 42 Formatting a Crosstab Report... 43 Logging Off... 46 Getting Help... 47 Updated 5/20/14 1
Logging on to the Information Warehouse Enter this URL in your browser's address window: www.princeton.edu/iw If you are on the Princeton network enter here. If you are outside the Princeton Domain, enter here Before July 1, 2014: Enter your LDAP (email) userid and password when prompted. After July 1, 2014: Enter via single sign-on per the below screen shots. Updated 5/20/14 2
After entering your password you will be prompted to answer a security question. Then you will be directed to the below window. Select My home. The Public Folders which you have permission to view will appear in the window. We will be using the Cognos 8 Training package for these examples. All Query Studio users have access to this data. You may read the documentation or recreate the examples shown if you d like to follow along in the exercises. Updated 5/20/14 3
Launching Query Studio From the Public Folders window select Query Studio from the Launch pull down menu. You can select a recently used package or select one of the packages in the list below. The blue folders contain data. If you click once on a blue folder Query Studio will launch and take you to the New report window. We will be working with the data in the Cognos 8 Training package. The yellow folders contain existing reports. Once you save your new report it will be stored in the similarly named yellow folder, i.e. Cognos 8 Training Reports. Updated 5/20/14 4
Working in Query Studio A great feature of working in Query Studio is that as you build your report you will see it in the report window. As you add fields, data will appear in the report window so that you can quickly see if the data you are choosing is what you want to view in your report. New Report Window In the New report window you will find your data and related functions on the left and the new report field on the right. Using the Back and Return Buttons It is not recommended that you use the Back button located in the top left corner of Cognos Connection window. Cached data will be used to return you to the previous window. It is recommended that you use the Return button located in the top blue menu bar, right side if you want to leave the report and return to the Folders page. You will be prompted to save your report before leaving the report page. Updated 5/20/14 5
The Standard Toolbar The Standard Toolbar includes the most commonly used report functions. Create a new report. Open a report. Save a report. Save As: saves a report in another location, or with a different name. Cut the selection. Delete is preferred to cutting. Paste (before the selected report item). Delete selection. This function is preferred to cutting. Undo last action or last several actions until the last time you saved the report. Redo last action(s). If you undid an action and decide you want to recover the last action(s). Run with all data (and re-prompt). Create a new filter or modify an existing filter. Updated 5/20/14 6
Suppress options: No suppression, suppress rows, or suppress values. The Suppress Options function allows you to choose the values you want to suppress, or not suppress in the report. Sort: The selected field will be sorted in ascending order. Summary: When you select a field in the report a summary row will be created at the end of the report summarizing all numerical fields. Calculate: Perform simple calculations that add new data fields to your report. Drill Down, Drill Up and GoTo functions: Drill Through: These features are used in the Cognos Reporting tool. They allow you to drill down or drill up from one report to another report or from one report to another query or a query to another report or any multi-dimensional analysis to a report. We do not use these features in Query Studio. Chart: Create a chart or graph for your data. Group: Order the data by a selected field. Pivot: Creates a crosstab report. Ungroup: Removes groupings and sections. Creates Sections: Format the report into sections. Swap Rows and Columns: Swaps rows and columns in a crosstab report. Collapse Group: Summarizes grouped data. Expand Group: Expands summarized data. Updated 5/20/14 7
The Style Toolbar The Style Toolbar includes the most commonly used text functions. Font: Select the font style of text. Font Size: Select the font size of text. Font Color: Select the font color of text. Bold: Bold selected text. Copy: Copy selected text. Underline: Underline selected text. Background Color: Select background color for fill from pre-selected palette or custom colors. Text Alignment: Select your text position within the report. Change Font Styles: A window will open allowing you to change the various font, styles. Change Border Styles: A window will open allowing you to change the various border styles. Updated 5/20/14 8
Data Menu The Insert Data tab shows you the data items contained within the package you are using for your report. The Edit Data tab shows you many of the standard toolbar data related functions in a vertical format. Updated 5/20/14 9
The Change Layout tab shows you many of the standard toolbar format functions in a vertical format. The Run Report tab shows you the run, preview and view options available for the report. Updated 5/20/14 10
The Manage File tab shows you the open and save options available in the standard toolbar, in a vertical format. Updated 5/20/14 11
Creating Simple Reports We are in the New Report window as shown on page 5. We begin by selecting data for our report. Select the Insert Data tab, which shows the Cognos 8 Training Data. Click to the left of the Report Net Training Data to expand the data groups. The plus sign will become a minus sign after you expand the data. For this report we will be selecting data from the Job Data module. Click once to expand the Job Data. Updated 5/20/14 12
Selecting Fields for your Report Double click on, or drag and drop all data items in Job Data, except Middle Name, to the report page. Add one field at a time. Double-click: if you double click to add fields, they will load from left to right. Drag & Drop: If you drag and drop a data item from the menu into the report page you can place it before, between or after any data items already in the report. When you see a flashing vertical black line with white on either side release the mouse and the data field will load into that location. Name and save your report. Remember to save often while working on a report. Deleting a Field from your Report Looking at this report we can see that we can use Full Name, or the Last Name, First Name fields. We decide to delete the Full Name field. Place your cursor anywhere in the column header or field and click once to select the column. It will change color when selected. Click once on the Delete button and the field will be removed from the report. The Delete button can also be found on the left in the Edit Data menu. Updated 5/20/14 13
Adding a Title to your Report Click once on the Title, and the Edit title area window will open. Type the Report Title into the Title window. You may also add a subtitle. You have the option to show or not show filters, sorts and suppressed items. We are naming this report Employee Salary Report. Once done, click OK. Updated 5/20/14 14
Saving a Report Save your report early in the process of creating it. Continue saving your report as you make changes to it. If there is a problem with the reporting tool or the system you will have a current version of your report. Click once on the Save or Save As buttons located in the left Manage File tab, or in the standard tool bar. The Save As window will open. We are saving this report as Employee Salary Report. You may add a description and/or screen tip. You can save your report in My Folders where only you will have access to the report. After you select the location click OK to save your report. Updated 5/20/14 15
Sharing a Report Package Custodians can save a report to a public location. If you are not a Package Custodian and you want to save your report to a public location, save it to My Folders first. Then select Save As. Remember to click OK when finished. Click on Select another location, and navigate to: Cognos > Public Folders > Cognos 8 Training Reports > -Inbox Save the report in this location. You will need to contact your Package Custodian and ask them to save the report. Be sure to provide the name and location of the report, and in which package you would like the report kept. If you do not know who your Package Custodian is go to: http://www.princeton.edu/iw/access-permissions/who-to-contact/ where you will find contact information for all Package Custodians. Updated 5/20/14 16
Changing a Field Name If you double click in a column header (field name) the Rename window will open at the bottom of the report page. You can rename the field in the Name window. Click OK for the report to accept the field name change to EmpID. Updated 5/20/14 17
Creating Sections Some fields may appear throughout the report containing repeated data. In our report the Dept ID and Dept Name contain repeating data. The report may look cleaner if we section it. Click once in the column or column header that you want to section. Sectioning Multiple Fields: You may also choose multiple fields to section by holding the Ctrl key down while clicking once in each column that you want to section. The Create Sections button can be found on the left side in the Change Layout section, and in the standard toolbar. Updated 5/20/14 18
Query Studio sorts sections by column order. Dept ID is the 4 th column and Dept Name is the 5 th column, so the sections are grouped by Dept ID first and next by Dept Name. Summarizing Data The Summarize Button can be found in the Edit Data tab on the left, or in the standard toolbar above. Click once in the field that you would like to summarize. This will highlight the field. Then click on the Summarize button to complete the action. The default summary value is Total. Note that creating sections results in summarizing Salary and Years in Role data. Since we have sectioned 2 data fields (Dept ID & Dept Name) each section has its own summary row. Query Studio will summarize numerical data in the report. Note that EmpID has not been summarized. Query Studio recognizes that field as a unique identifier, and not numerical data. Updated 5/20/14 19
Changing Summary Values We can use the Summarize option if we are looking for a specific value. For this example let s identify the Average Years in Role by Department. Highlight the value you would like to change. Then right click in the highlighted value and the Edit Data menu will open. You may also use the Edit Data menu toolbar on the left. Click once on the Summarize option and the Summarize window will open. Updated 5/20/14 20
Changing Summary Values (continued) You can use the basic or advanced Summarize options. The basic window opens first below. If you select the Advanced button on the right a window will open allowing you to select different summary values for the cells and for the footers. Select the value you want from the Summary for footers pull down menu. Select Average. Click OK. Updated 5/20/14 21
Formatting Data The Average Years in Role value is returned with 8 decimal places. We want to format the data to return 2 decimal places. Click once within the cell values. Select Format Data from the left Edit Data menu, or right click to open the Edit Data menu. The Format data window will open. Select Number from the Category pull down menu. Updated 5/20/14 22
Formatting Data (continued) A new Format data window will open. Options will appear on the right for: Number of decimal places Scale Negative sign Thousands separator Select 2 decimal places. Click OK. Updated 5/20/14 23
Formatting Data (continued) The re-formatted Average Years in Role is now formatted with 2, not 8 decimal places. Updated 5/20/14 24
Using the Undo/Redo Buttons The Undo/Redo buttons allow us to undo or redo the most recent actions we performed in the report. The Undo/Redo buttons are located in the Edit Data toolbar on the left, or in the standard toolbar on the top right. We want to undo the Average Years in Role summary and return to the Total Year in Role summary values. To undo the last action click on the Undo button once. The report will undo the last action and reload. After each click view the report to see how it changes. It will take 3 clicks to return the Total Years in Role value of 101.00. Undo the decimal place formatting: Highlight the Years in Role column. Right click and select Format Data. In the format Data window under Number of decimal places select 0. Click OK. The Years in Role Data should look like the table on the next page. Updated 5/20/14 25
Sorting When we look at the sections we can see that Last Name is not sorted alphabetically. It is sorted numerically by EmpID. We would like to sort each section by Last Name. Click once in the Last Name field to highlight the field. You will notice that the Last Name field will be highlighted in all sections. Go over to the Edit Data menu to find the Sort button, or up to the standard toolbar to find the Sort button and click once. The first time you click the Sort button it will sort alphabetically ascending. If you select the same data field again and click on the Sort button it will sort alphabetically descending. If you select the same data again and click on the Sort button it will return to the original unsorted data. Updated 5/20/14 26
Sorting (continued) Each section is sorted by Last Name ascending alphabetically. The Sort icon is also added to the report page. Note that the Sort Up arrow appears to the right of Last Name in the column header indicating that this field is being sorted alphabetically ascending. A Sort Down arrow indicates that data field is being sort alphabetically descending. Updated 5/20/14 27
Adding a Filter to your Report The report as currently written shows all departments. By adding a filter we can choose the department(s) that we want to view in our report. Click once on the field that you would like to sort. For this example we want to filter on Dept ID. Then click once on the Filter button in the top right Standard Toolbar, or in the left Edit Data window. The Filter window will open. In the Condition window you have the option to show, one, several, all, or no data items. You can choose to show or not show Missing Values. Updated 5/20/14 28
Adding a Prompt to your Filter In the Filter window you can also create a prompt, using your new filter. Check the Prompt window. We are going to select all of the fields in the Condition window. This way you can report against one or more of the fields, when they appear in the prompt. When you have made your selection, click OK. Updated 5/20/14 29
You will return to your report window. Notice that a new Filter is now showing at the top of your report. The filter indicates that we are filtering on Dept ID. Updated 5/20/14 30
Running your Report with a Prompt Let s run the report to see how the prompt works. Select the Run button in the standard toolbar, or you can use the Run Report tab on the left if you want to run the report with all data, preview the report, or view in a selected format (PDF, Excel, CSV, XML). For this report we will select DeptID s 100, 400, and 700. Click Finish when you are ready to run the report. To select multiple values hold down the Ctrl key and click once on each value to highlight it. Updated 5/20/14 31
Viewing your Report Your report should look like the below screen shot. Notice that the Filter shows the values we selected for the 3 DeptIDs. Updated 5/20/14 32
Creating Groups Looking at the report we decide to modify the format. We want Dept ID to appear above each section, and the Dept Name to appear within the section. To make this formatting change we need to use the Group function. Click once in any Dept Name field and this value in all sections will be highlighted. Select the Group button in the Change Layout menu, or in the standard toolbar. Updated 5/20/14 33
The report will re-format and Group by Dept Name. The Dept Name header has become the first column in each section. Updated 5/20/14 34
Creating a Calculated Field The Calculate button will allow you to add a calculated field to your report. It can be found in the Edit Data toolbar on the left, or in the standard toolbar at the top of the page. Select Insert once you have created your Expression. To create the new field you must select and reference an existing field in your report. For this example we will add 2 fields: 1) 2.5% of the Salary 2) Salary Increase field, which will be the current Salary plus the value for 2.5% of the Salary. Click once in the Salary field, then click on the Calculate button. The Calculate window will open. Select * (multiplication) from the Operation pull down menu. Select Number and enter a value of 0.025 Note: the Expression window will populate with Salary * 0.025 as you enter the information. Under New item name: type in 2.5% of Salary. Updated 5/20/14 35
Creating a Calculated Field (continued) The report populates the newly created 2.5% of Salary field. Updated 5/20/14 36
Creating a Second Calculated Field We now want to calculate the Salary increase. To create the new field we will reference the Salary and 2.5% of Salary fields. Click once in the Salary field, hold down the Ctrl key, then click once in the 2.5% of Salary field. Select Insert once you have created your Expression. Click on the Calculate button. The Calculate window will open. Select + (addition) from the Operation pull down menu. Note: the Expression window will populate with Salary * 0.025 as you enter the information. Under New item name: type Salary with Increase. Updated 5/20/14 37
Creating a Second Calculated Field (continued) The report has created and calculated the Salary with Increase field. Updated 5/20/14 38
Report Format Options Run your report. Select all the Dept ID values when the prompt appears. Select Finish. Updated 5/20/14 39
Report Format Options (continued) The report will run all Dept ID values. In the Run Report menu on the left we can choose among different ways to run, preview and view the data. For this example we will select View in Excel 2007 Data Format and open the file. The below window will open. Select Open. Updated 5/20/14 40
Excel Report Format The report below is generated in the Excel 2007 Data Format. It is necessary to format and save the report since we chose the Open and not Save function. Updated 5/20/14 41
Creating a Crosstab Report A crosstab report displays data in both horizontal and vertical dimensions. To create a crosstab report you need at least 3 data fields in your report. The below tables are sectioned by Dept ID. We will create a crosstab report using Dept ID. Click once in the Dept ID header. All Dept ID section headers will also be highlighted. The Pivot/Crosstab button can be found in the Change Layout menu on the left, or in the standard toolbar on the top right of the report window. Click the Pivot button once. Updated 5/20/14 42
Formatting a Crosstab Report The below report view is created. We want to format the report since the Dept ID columns are randomly listed and we would like to view them numerically, 100, 200, 300 etc. Notice that the field name headers (Dept Name, EmpID, Last Name, First Name, Dept ID) disappear when the crosstab is created. Click once in any Dept ID field. Click once on the Sort button. First click ascending order, second click descending order. Updated 5/20/14 43
Formatting a Crosstab Report (Dept ID) The below report view is created. You can see that the Dept ID is now listed in numerical order. The Dept Name needs to be sorted next since it is not in alphabetical order. Click once in the Dept Name header. All Dept Name sections will also be highlighted. Click once on the Sort button. Updated 5/20/14 44
Formatting a Crosstab Report (Dept Name) The below report view is created. You can see that the Dept Name is now listed in alphabetical order. Save your report. Updated 5/20/14 45
Logging Off When you are ready to log off click the Log Off button in the standard toolbar. You will be taken back to the Single Signon window. You can choose to log out of all applications, or just this current session of Query Studio. We are logging out of all applications, so we choose Yes. Updated 5/20/14 46
You will be taken to this window and reminded to exit your browser. Getting Help Remember: If you feel all alone on an island of data reach out to your DWI team members. We are here to help. E-mail: information-warehouse@princeton.edu Updated 5/20/14 47