Presentation on theme: "AM Queries and Views. Overview Asset Manager provides sophisticated querying and reporting capability, from simple filters to a complex language that."— Presentation transcript:
AM Queries and Views
Overview Asset Manager provides sophisticated querying and reporting capability, from simple filters to a complex language that allows for dynamic queries and reports. Can be performed through user interface without need for Crystal Reports or other reporting package Results can be exported to Excel Simple one-click query engine Robust querying language for more complicated inquiries Note that more complex reports (reports with grouping, reports needed formatting) must be created in Crystal Reports. This is outside the scope of this course.
Terminology View: any AM screen that shows a list of records at the top of the screen and detailed information about certain specific records at the bottom Examples: My Open Work Orders, My Timesheet, many others Query: The logic that determines what records are displayed in a view. Example: For My Open Work Orders, show all records that were opened by the current user and the work order status is not complete or cancelled Operators: Special symbols that are used in writing queries AND, OR, NOT =, <> (matches exact values) LIKE (matches text patterns using the special wildcard symbol: %) Manufacturer LIKE DYNA% matches DYNATECH and DYNAMAX but not GENERAL DYNAMICS; %DYNA% would include GENERAL DYNAMICS also Report: A more formal view that incorporates formatting, highly complex queries, etc… typically these are run in Crystal Reports.
Portrait of a Database
Introduction to the Simple Query Filter The simplest way to run a query is to right-click on the field youd like to query on. In this case, were querying on the status of the work order to limit our list to only work orders that are awaiting service.
Introduction to the Simple Query Filter Choosing Filter on this field when you right-click on any form element opens up the simple query filter box. The box is automatically populated with the element that you clicked on. Click on the flashlight icon (or press F5, or the Enter key twice) to apply the filter.
Introduction to the Simple Query Filter Note: Right-click anywhere in the query box and choose Remove this filter to clear the filter and return to the original list.
Exercise 1 Using a simple query filter, display a list of all work orders on devices with a Risk Class of Life Support.
Using Multiple Simple Filters Simple query filters can be combined to refine your search results. By adding a simple filter from the Work Order menu, you can perform a search using two criteria. (Note that this is an AND search: results will match both criteria you specify. Well cover OR searches later.) Note: Unfortunately you cant use the right-click method more than once per screen; itll wipe out all other filters.
Using Multiple Simple Filters Use the pulldown to select the second field youd like to query. In this example, were querying on Status = Awaiting Service and Work Order Type = Maintenance.
Exercise 2 Using a combination of simple query filters, display a list of work orders that were opened after July 1, 2011 and completed before July 31, (Hint: youll need two simple filters, one based on Start Date and another based on Complete Date.)
Hints on Finding the Field You Want Note: Sometimes when using the query box it can be difficult to find the field you want to search for. In the previous example, for instance, the Work Order Type field was actually located under Links Work Order Type. The rule of thumb is that if theres a magnifying class next to a field on the form, its going to be located under the Links section of the query box pulldown: Remember, you can just right-click on the field you want to filter on, and choose Filter on this Field. Simple as that!
Saving your Newly-Created View Views can be saved for your future use. Save your view under Tools > Views > Create a Custom View, give your view a name, and press Add: Your custom view will then be visible in the Navigation Bar under User Views: …try saving your view from Exercise 2 now!
Exercise 3 Using a combination of simple query filters, display a list of Incoming Inspection work orders that were opened after July 1, 2011 and completed before July 31, (Hint: Modify the query you created in Exercise 2.)
You can easily add fields to your view by right-clicking on the field and selecting Add this column to the list. Try adding Serial Number to the work order view you created in Exercise 3. Remember to save your updated view when youre done! (Tools Views Modify Current View). Well reorder the columns later. Adding Columns to your Results
Exporting to Excel Exporting the results of a view to Excel can be useful for ing data, making charts and graphs, printing out lists, etc. You can export any list in AM by right-clicking anywhere on the list portion of the view, then under Utilities, look for Export the list…
Grouping Your Query Results You can also group your query results by any field you like. Right click on the field youd like to group by, then select Group by this field or Group by this link (like on Assigned To in your previous exercise). Your results will even remain grouped when you export to Excel. Cool! (Undo the grouping by right- clicking anywhere in the list and selecting Ungroup all.)
AM Queries and Views … part two!
Advanced Queries Asset Manager provides a more sophisticated query language that provides all of the capability of simple queries, but with added features like OR and NOT. Access the Advanced Query window by clicking on the filter icon at the bottom- right of any list:
Advanced Queries, Continued In the Advanced Query window, you build your query by selecting which field you want to query on… Then the value you want to match…
Advanced Queries, Continued And finally, click the red down arrow to build the query based on your selections: Press OK to run the query and see the results. Youll notice that the filter icon you pressed to enter the Advanced Query window is now red. This is an indication that an advanced query is being used to display your results.
Exercise 4 Using the Advanced Query window, design a view that displays all work orders where the work order status is Awaiting Service. (Note: You could do this with a simple query, but lets practice the advanced query method here.)
Using Operators Youll notice that the down arrow isnt your only choice when building your advanced query. Theres also an AND down-arrow button and an OR down- arrow button. You can use these to create more complex queries.
Exercise 5 Building on the advanced query you wrote in Exercise 4, write an advanced query that displays all work orders that are either Complete or Awaiting Service.
Exercise 5A Change the OR to and AND for the query you wrote in Exercise 5, and view the results. What happened? Why?
CurrentUser: A Very Special Variable Asset Managers query language includes a special variable called CurrentUser. It must be typed in manually as it is not included in any of the pulldowns, but it can be very handy. Whenever you use CurrentUser, AM will automatically substitute the name of whoevers logged in at the time… i.e. YOU. Use the CurrentUser variable to automatically include your own name in queries.
Exercise 6 Using the CurrentUser variable, search for all the work orders in the database that are assigned to you. NOTE: Finding the Assigned To field can be tricky. Asset Manager often stores data in separate lists, like lists of Employees, Vendors, or Manufacturers. It stores links to these lists under the Links section. When choosing the Assigned To field, look under the Links section of the field youre searching on (its hidden at the top of the list… youll have to scroll up to find it, then expand the list of links). In general, if you cant find the field you want under the list of fields, check the links section too. Ill be distributing a cheat sheet that shows you where to find some common fields in the hierarchy. Eventually youll develop a feel for where they are on your own.
Weve already learned that you can right-click on a field and choose Add this column to the list to include a column in your view. You can also click on the Columns and Sort tab in the Advanced Query window, choose the field you want to add in the hierarchy, then press the right arrow button to add it to your list. You can also change the order of columns in the list. Try it out! (Hint: Use the up and down arrow buttons in the middle of the window) Adding and Reordering Columns in your View
Exercise 7: The Kitchen Sink! Design a query that shows only Malfunction Reported work orders (that is, work order type is Malfunction Reported) that are assigned you, and that were opened on or after 7/1/2011, and are either currently In Progress or Awaiting Service. Help each other out!
Something Cool: Statistics Youve already learned how group your query results by any field you like. You can also do this graphically! In your kitchen sink example, locate the Risk Class field (hint: its on the More Info tab), right-click on it, and select Statistics pertaining to this link, and watch the magic happen. (You can also do this from the list at the top of the form: Right-click on any column and choose Utilities Statistics on this column.) Right-clicking on the graph gives you plenty of configuration and printing options, too. Sweet! Unfortunately, this feature seems to be somewhat experimental and doesnt always return results. Its worth playing around with, though.
Homework Play around! Dont hesitate to experiment and help each other out. Create your own custom views and save them for use in your daily activities. Thanks for coming!