/
Queries 101 - Basics
  • Rough draft
  • Queries 101 - Basics

    Table of Contents

    ⬜ Intro

    Back to top

    Queries allow for users to search in AiM with a defined set of criteria. The search criteria fields contain operators that can be used to search records in different ways, such as “Starts with”, “Ends with”, or “Contains”.

    Why will a Query help me? When using a database full of information you will want to retrieve very specific records. These records can be obtained by utilizing a query. 

    🔵 What is a Query?

    Back to top

    What is a Query?
    Throughout the AiM system, you can create a New Query. Queries are built inside of a search screen. You can access a Query/Search screen in a couple of ways:

    1. Clicking on a magnifying glass icon at any level within the AiM platform.

    2. Inside any Record that you have open, click on the blue Search button. This will take you to the Query/Search screen for that specific Record and the Module it’s in.

    image-20240329-211550.png
    Accessing a query screen - Clicking on a magnifying glass icon at any level within the AiM platform
    image-20240329-211835.png
    Accessing a query screen - Inside any record that you have open, click Search to open the query screen for that specific record

    A search/query exists for every single record in AiM
    Query example - You have a $5,000 budget and 12 employees have charged time to this work order and we are currently at $5,800.
    Create a query that will tell you - All the jobs that are over budget or I wanna see all the jobs that are 25% of going over budget.

    Queries do not work like Google, Yahoo, and other search engines where you can use multiple words in a single field and get related results. Though the results will be different, every Query screen will have the same buttons and options for building and saving the search.  The part that changes is the data being searched for within the record.

    • A query is a custom search for details about records in AiM.

    • After executing a query it will display a "Browse" list of all the records that match the different search elements.  

    • Queries can be built for a single search or saved for future use.

    • Queries can be shared with other people or groups of people.

    • Saved Queries can be made into a Dashboard Widget and shared with a group.

    • Saved Queries can be used for Highcharts. These are visual displays of the results in the form of a chart or graph.  These charts can be added to Dashboard Widgets.

    • There is no limit. If the data is in the system, you can query it!

    A personal query is a custom search for desired information based specifically on the user creating it.
    Optionally, it may be associated to a role for more global usage.

    Examples of some common Queries

    • Show all Work Orders for a specific building.

    • Show all Work Orders assigned to a specific person.

    • Show all Purchase Orders to a specific vendor.

    • List all active properties.

    • Find my "Employee Profile".

    • Display all emergency or high priority Work Orders.

     

    🟩 Anatomy of a Query Screen

    🔵 Basic Overview

    Back to top

    To navigate to a query screen, from the WorkDesk, click on any module in the left hamburger icon Menu. You will find additional left menu options, some of which have a magnify glass icon next to them.

    image-20250320-202729.png

    Click on a magnify glass icon next to your menu choice for which you would like to create a query for.

    These three buttons can be found at the top-left of a query screen:

    image-20241120-193506.png
    image-20250320-203140.png
    • Execute - Runs the query

    • Basic Search/Advanced Search - This is a toggle. The button will show which option you WILL switch to by clicking it, NOT which option you are currently on.

    • Reset - Resets the entire query screen. This is useful when your search results appear to be wrong. You can click Reset and start over knowing all fields have been reset to their default settings.

    Basic vs Advanced Search
    Basic Search - Gives the user a limited number of options for searching. This is often sufficient for more users.
    Advanced Search - Gives the user access to more query options to do more complex queries.

    By default, all users start with Basic Search. Your System Administrator can change your default for you.

    Below is a screenshot of the search page for Asset Package, under the Asset Management module. Under Action in the left menu, you will find the link to open and begin creating a New Query.

    Below Action, View will be empty until the Query has been saved.

    Queries you have already created can also be edited and either replace the original query or saved as a completely new query.

    screenshot-search-query-screen_aj.jpg

    🔵 Subordinate Tables (aka Supplemental Tables)

    Back to top

    ⚫ Query Screens with Multiple Tables

    A query screen can include multiple tables. The Primary Table is listed first. After that, each additional table will have its own Heading Bar. If the header is indented, the table is subordinate to the table above it.

    In the screenshot below, the Notes Log table is a Subordinate Table to the Primary Table (which is always the top-most table of a query screen).

    image-20250320-203630.png

     

    ⚫ Display Order & Header Operations

    Back to top

    Subordinate Tables will either have the Display Order column and its sort options, or the Header Operations (Operator dropdown list next to the header). It cannot have both.

    The Subordinate Tables without the Display Order column options cannot be displayed in the final query results.

    In the screenshot below, the red boxes highlight the display order column fields. The green boxes highlight where the display order column fields are missing, and there is an operator dropdown list next to the header for those tables, instead.

    Both display order and header operations are described later in this tutorial.

    image-20250320-174101.png

     

    🟩 Query Screens Overview

    Back to top

    Below are detailed descriptions for navigating the screens found when creating a Query.

    🔵 Starting a Search

    Back to top

    From your WorkDesk, click on the hamburger icon on the left to expand your top-most search options/how you want to start your search.

    Summary of the screenshot, below:

    • The Module - The top level category of records

    • The + Sign - Starts a New Record

    • The Magnify Glass - Takes you to the Query screen where you can create a new query or edit existing ones

    • The Record Name (under the Module) - Takes you to a new blank screen on that record level. (From there, you can also access the Query screen by clicking on the Search button in the record screen).

    QueryOverview1-cropped.jpg

    🔵 Starting a New Query from a Record

    Back to top

    ⚫ Opening a Record

    This is what the screen looks like when you click on the Record Name (under the module). The Record Name can be found at the top: In this example, Personal Query is the record name.

    Click on Search to dive deeper into this screen.

    QueryOverview2-cropped.jpg

     

    ⚫ The Query Screen (for the Record Name Selected: E.g., Personal Query)

    Back to top

    Below is the Query screen, after clicking Search on a Record. Some primary features of this screen include:

    • Execute - This will run the query.

    • Basic/Advanced Search - Toggling between the two options will show which option you will go to, NOT which option you are currently on.

    • Reset - Resets the entire query screen to defaults

    • Action > New Query - Under the Action menu on the left, click on New Query to start a new query.

    QueryOverview3 - cropped.jpg

    🔵 The New Query Screen

    Back to top

    This is the query screen of a record. To start a new query, click on New Query under Actions in the left menu.

    image-20250313-183507.png
    Creating a New Query by clicking the link under Actions from the query screen of a record
    • In the New Query screen (screenshot below), first complete the Title field. The Description field below it is optional.

    • When Query Listing and Query Count are set to Yes, the Query can be displayed on the Dashboard.

    • Setting the yellow and/or red flag fields will make the query flag turn yellow or red on the WorkDesk or when it reaches the set number. These fields are optional.

    • Module - The module section displays the screen from which the personal query will be based.

    • Chart Type (aka the AiM IQ embedded reports section/block) - Identifies the different charting options to display a visual representation of the data you are about to build a query for.

    • When you are finished and click on Done, the search will open in build mode.

    image-20241120-231120.png

    After all criteria are entered, click Save to save the query.

    image-20241120-231514.png

    Selecting Execute in the following screen will take you to the Query Results/Browse View of the query.

    🔵 Query Results (aka Browse View)

    Back to top

    In your query search results, click on a Record link to display the details of that record.

    Or, you can click the blue Search button to return to the Query screen (second screenshot, below) on the record level under the module you chose (in this example, Personal Query).

    QueryOverview6 - cropped.jpg
    QueryOverview7.jpg

    🔵 How the Query Screen Looks After Saving 1+ Queries

    Back to top

    Before we saved a query, the only option under Action was New Query. Now, Edit Query has been added.

    Under View, there were previously no options. But after saving 1 or more queries, those saved queries are listed under this section.

    Queries can be built and saved for future use. Queries you have already created can also be edited and either replace the original query or saved as a completely new one.

    image-20241120-232028.png

    🟩 Personal Queries

    Back to top

    Personal Queries can be created under any Module in AiM.
    You can also view All Personal Queries created under All Modules via the System Administration Module

    From the WorkDesk, click on the hamburger icon on the left and click on the System Administration Module

    Click on the Magnify Glass icon next to Personal Query

    image-20250103-232040.png

    In the next screen, click Execute to view all your Personal Queries, across all modules.

    image-20250320-205457.png

    You will see a list of your personal queries (example screenshot, below).

    image-20250103-230206.png
    List of a user’s personal queries

    Click on one of the Query links to open that page. Here, you can Edit the chosen query and share the query to group(s).

    By default, Personal Queries are “personal” to the user that created them, and are not visible to other logins, until shared with other groups.

    image-20250313-200127.png
    Top-left screen - Click on one of the saved query links | Bottom-right - Click Edit at the top of that screen | Bottom-right (yellow-highlighted) - You can add/share the query with other groups in Edit mode

    🟩 Query Screen Options

    🔵 Display Order

    Back to top

    ⚫ Search Result Columns

    Display Order is a functionality of the Query screen that allows you to set the order of the columns of information that will show up in the search results screen.

    By default, each query will display a set of predetermined fields. These can be overridden by placing numbers in this box. Once a number is entered, only numbers with values entered will be displayed.

    It’s best to start with numbers like 10, 20, 30, etc. to allow other elements to be added in between without having to renumber other fields. Consecutive numbers are not required. All of this is explained in more detail later in this section.

    image-20250106-174915.png

    Here, we’ll start with a basic search query to walk through the details of using the Display Order feature.

    From your WorkDesk, select the Module under the Menu to perform a search. In this example, Work Management is selected.

    image-20240329-211415.png

    In the screen for the Module you selected (in this example, Work Management), under Menu, select Phase by selecting the magnify icon.

    The Phase search has the most options.

    image-20240329-211550.png

    Or if you clicked on the word Phase instead of the magnify icon, in the next screen, click on Search.

    image-20240329-211835.png

    You can toggle between Basic Search and Advanced Search. Basic Search will not allow you to sequence the way the phase search results are displayed (explained in Step 5, Display Order). 

    AiM often remembers information from your last search. Whenever creating a new search, click on Reset

    image-20240329-212037.png

    The Display Order column allows you to sequence the search results, displaying the columns of data in a specific order.

    When sequencing numbers for the display order don't enter 1, 2, 3, 4, 5, etc.  It is better to allow space between your numbers 10, 20, 30, 40, etc. in case you want to go back and modify the search by displaying another field. 

    In this example, we want the columns of data in our search results to be presented in this order: Work Orders, Phase, Phase Description, Status, and Shop.

    [Display Order - 5] Displays the Work Order number first/in the 1st column of our search results because 5 is the smallest number we enter in a Display Order field for this search. Typically all that is needed in a search at the work order level is the work order number. 

    image-20240329-214545.png

    [Display Order - 10] Display the Phase number next/in the 2nd column of our search results because 10 is the 2nd smallest number we enter in a Display Order field.

    [Display Order - 20] Display the phase Description.  The phase Description will show up in the 3rd column of our search results because 20 is the 3rd smallest number entered in a Display Order field for this search.

    [Display Order - 30] Displays the Status in the 4th column.  Select the operator to make the search more meaningful. In this example (below) Closed, Closing, Incomplete, Deferred, and Complete - Pending R are excluded by changing the Operator to not in.

    [Display Order - 40] Displays the Shop in the 5th column. Select the shop desired for the search. In this example, Electrical is the shop search.

    image-20250313-173528.png
    Display Order #s - (5) Work Order, (10) Phase, (20) Description, (30) Status, (40) Shop | Operator (Not In) Closed, Closing, Incomplete, Deferred, Complete - Pending R | Operator ( = ) Electrical

    When done select Execute.

    image-20240329-214855.png

    Notice the display order of the columns follows the sequencing that was added to the Display Order fields.

    image-20250320-210420.png
    Display Order of Columns - (5) Work Order, (10) Phase, (20) Description, (30) Status, (40) Shop

    Under the Action menu, the search can be exported to Excel by clicking on Export.

    image-20240329-215007.png

    ⚫ Ascending/Descending

    Back to top

    In addition to the ability to set the column Display Order using numbers in the designated fields, another part of the Display Order feature includes the ability to select between Ascending (Asc) or Descending (Dsc). This will determine the order of the rows of data included in a column.

    image-20250106-175824.png

    In the example below, the Status is set to be sorted in descending order, starting with “New.”

    image-20250108-223822.png

    🔵 Value & Operator

    Back to top

    ⚫ Value

    Searching for a Work Order with the Value, 12345, this is the value used by the operator to determine if a record will be included in the query results or not.

    image-20250106-175542.png

    ⚫ Operators

    Back to top

    ⚪ Intro

    Here (screenshot) is a standard list of Operators that can be applied to most rows of your search criteria. The selected operator applies to the value entered in the column after it.

    image-20250106-175958.png

    The logical operators (=, >, <, >=, <=, <>) work as expected.

    Starts with and Ends with work by looking for the value at the beginning or end of a value entry. Contains looks for the value anywhere in the data element. In and not in asks for records where a specified data element is either in or not in them.

     

    ⚪ Dates

    The operators for Edit Date (screenshot below) ask the query to pull records that meet the specified date criteria. Operators unique to date criteria include: Between, Older than, Last, Within, Next and Newer than

    image-20250317-232952.png
    Search options for Edit Date - =, >, <, >=, <=, <>, null, not null, between, older than, last, within, next, newer than, >= today

     

    ⚪ Null & Not Null

    With some data elements, you can look to see if the element is empty (Null) or has something/anything in it (Not Null).

    image-20250109-003518.png

    Referencing the screenshot above,

    Null would return all projects in a Phase that does not have the Project filled in. Do not type in the search field, it must be blank.

    Not null only returns records with populated Problem Codes. The search field can be left blank to return all records that have anything entered for the Problem Code, or when specified in the field, returns only records that have been entered.

    ⚪ Columns

    The column search qualifier is one of the more powerful operators that compares two different databases.

    A column operator could be set to a column search qualifier (e.g., = column, > column, < column, >= column). When that happens, the compare to column options become available.

    image-20250320-170019.png

    Examples:

    My Total Estimate is = to my actual total (the = populated an additional column with selection choices) as a comparison.

    Show me all Work Orders when my Estimated Total is less than My Actual (You are looking for an overrun estimate).

    In the example below, from the work order search screen, phase costs section, selecting the >column operator for Actual Total searches for all phases where the Actual Cost has exceeded the Estimated cost opens a list of other common fields for comparison. In this case, Estimated Total.

    image-20250317-215725.png

    Below, you will see the Cost Analysis for the Phase. If you had multiple Work Orders, the cost analysis of this would level up on this phase.

    cost analysis search.jpg
    cost analysis view.jpg

     

    ⚪ Users

    Below, the user operator returns all records created by whoever is logged in at the time.

    image-20250108-232726.png

    User defined fields create additional customized reporting and management capabilities.

     

    ⚪ Other Examples of Operators

    The in and not in operators allow you to specify one or more values to include or exclude.

    • In - The Facility in the admin building and Property in Gardens

    • Not in - The Project not in the lobby and Problem Code not in Too Hot-Zone 1

    image-20250317-234444.png
    “In” & “not in” operators in use

    The search qualifier, between. The fields must be within the listed range (date and numeric fields only).

    image-20250317-234538.png
    The “between” operator in use | Date and numeric fields only

    Below are two example settings for search qualifiers newer than or older than.

    • Record returned must be more recent than 1 day ago.

    • Record returned must be older than 1 week ago.

    image-20250317-234616.png
    “Newer than” & “older than” operators in use for the Edit Date field

    Below are two example settings for search qualifiers last or next

    • Return records for within the last 1 month (from today’s date)

    • Return records with desired completion date in the next 5 days (from today’s date)

    image-20250318-002614.png
    “Last” and “next” operators in use

    The field must be within the listed time frame, within 1 day from the current date.

    image-20250317-234724.png
    “Within” operator in use | Date fields only - year/month/week/day/hour
    image-20250108-215736.png
    In this example, the “Status” equals “Open”
    image-20250108-215924.png
    In this example, the “Date Created” must be “later than” July 11, 2023
    image-20250108-220146.png
    In this example, the “Work Order” number must be “less than” 15-223345
    image-20250108-220250.png
    In this example, the “Description” field must “start with” the word “Broke.”
    image-20250108-220542.png
    This field must start with the data typed. If you’re searching for a “Contact,” with the “ends with” operator is selected, some example results could include:

    John Smith, Phil Goldsmith, or Mary Jenkins-Smith

     

    ⚪ Operators in Table Headers

    Table Headers (other than the Primary/top Table) can also have a drop down menu of operators. The example below shows the Notes Log header operators.

    image-20250106-182142.png

    Select - This is the default value. With Select, any criteria selected from this section acts just like the criteria in the Primary Table.

    Not Exists - The only records returned will be those where there is no record from this subordinate table. For example, when searching for Work Orders and you select Not Exists for the Notes Log, you will get Work Orders that don’t have any notes.

    Exists - This is the opposite of Not Exists. So, for the example above, the search will return any Work Orders that have a Notes Log record.

    Match All - With Match All selected, only records where all the records on this subordinate table are selected will be returned. An example of this would be for a Work Order query where the Phase is set to Match All and a Shop is selected. The only Work Orders returned will be ones where ALL the Phases have a specific shop.

     

    ⚪ Comprehensive List of Operators

    Qualifier

    Actions

    Examples

    Qualifier

    Actions

    Examples

    =

    Equals To

    Only open work orders will return in this search

     

    image-20240329-220031.png

     

    >

    Greater Than

    The dates that will return in this search are later than later Feb, 27, 2024

     

    image-20240329-220208.png

     

    <

    Less Than

    The dates that will return in this search are before Feb, 27, 2024

    image-20240329-220553.png

     

    <=

    Less Than OR Equal To

     

    >=

    More Than OR Equal To

     

    <>

    Not Equal To

     

    Starts With

    The field must start with the data typed

    This example would return phases that start with Bean Hall

     

    image-20240329-220943.png

     

    End With

    The field must end with the data typed

    This example would return work orders created by user who ends in “Pitts”

     

    image-20240329-221202.png

     

    Null

    Do not type in the search field, it must be blank

    This example would return all the work orders where the problem code wasn’t entered

    Null means “missing or blank”

     

    image-20240329-221409.png

     

    Not Null

    This example would return all the work orders where the problem code was entered

     

     

    image-20240329-221548.png

     

    In

    Allows the user to select multiple values. For this example multiple shops are selected.

     

    image-20240329-221850.png

     

    Not In

    Allows the user to exclude multiple values. For this example the selected shops will be excluded from the search results

     

    image-20240329-221949.png

     

    Between

    The search results will return work orders within the chosen date range

     

    image-20240329-222344.png

     

    Within

    The field must be within the listed timeframe (date fields only)

    Options: year, month, week, day, hour

      

    image-20240329-222552.png

    Newer Than

    The field must be within the listed timeframe (date fields only)

    Options: year, month, week, day, hour

    Record returned must be more recent than 4 days ago

     

    image-20240329-223101.png

     

    Older Than

    The field must be within the listed timeframe (date fields only)

    Options: year, month, week, day, hour

    Record returned must be older than 3 weeks ago

     

     

    image-20240329-223205.png

     

    Last

    The field must be within the listed timeframe (date fields only)

    Options: year, month, week, day, hour

    Record returned within last the month

     

     

    image-20240329-223321.png

     

    Next

    The field must be within the listed timeframe (date fields only)

    Options: year, month, week, day, hour

    Returns records with desired completion date in the next 5 days

     

     

    image-20240329-223517.png

     

    Column

    One of the more powerful operators that compares two different database columns

    Returns phases where the actual cost has exceeded the estimated cost. Find this in the phases costs:

    Options: =Column, >Column, >=Column, <Column, <=Column, >=%Column, <=%Column

     

     

     

    image-20240329-223745.png

     

     

    User

    Returns all records created by whoever is logged in at the time

     

    image-20240329-224338.png

     

    🟩 Extra Credit

    Back to top

    Now that you have studied all of the materials above, here is a video by AssetWorks to help you tie everything together.

    AiM IQ - 100 - What is a Query - 4.mp4

     

    Related content