Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

QueryBuilder allows you to examine your database information interactively, using a drag-and-drop interface. QueryBuilder can review your data, perform calculations such as counts and sums, and add dimensions to group and sort. In QueryBuilder, you can focus on a set of data in a SQLManager table and arrange that data logically.

Once you select the information you wish to see, with the click of a button, QueryBuilder allows you to see the data.

Why Use QueryBuilder?

QueryBuilder excels as a review, count, and calculate tool to briefly analyze your data. It is most helpful when attaching a function, such as 'count occurrences' or 'average' to a certain field such as 'CustomerCustomerNumber' or 'quantityOrderAmount.' You can quickly determine how many customers you have or the average number of items ordered. You may also see the average item or order cost. Please see the MarketWide Training Guide for more information.amount of an order. 

Topics

Table of Contents

Getting Started with QueryBuilder

QueryBuilder is a tool used across MarketWide that allows you to construct queries to pull back information from various tables and fields. After selecting a table from SQLManager (Image Added), you must select the fields that you wish to display , and then, using filter, in your results by dragging them from the left column into the Fields area. Then you can construct the query using a filter (Image Added). After this, you can adjust the dimensions as well as sorting fields. If you wish, you can also use a KPI filter based on your dimensions to further customize your results. Additionally, QueryBuilder provides offers flexibility by allowing you to choose how you build your query. You can build a query graphically or, if you already know SQL, you can type your query directly into the interface.

The QueryBuilder Menu and Toolbar

The toolbar provides quick access to commonly used commands in the QueryBuilder main window. Click the icon once to carry out the action represented by that icon.

Icon

Description

Menu Equivalent

Image Removed

Creates a new query.

File > New

Image Removed

Opens the Open Report dialog, allowing you to retrieve a saved query. 

File > Open

Image Removed

Saves the open query.
 

File > Save
 

--

Allows you to select how and where the query is saved.

File > Save As

Image Removed

Opens the saved query on your local machine.

File > Local > Open

Image Removed

Saves the open query to your local machine.

File > Local > Save

Image Removed

Submits your query for execution.

File > Submit

Image Removed

Checks the syntax of the query.

File > Validate Query

Image Removed

Opens the print dialog.

File > Print

Image Removed

Allows you to Sequentially undo up to the last 20 actions.

Edit > Undo

Image Removed

Allows you to Sequentially redo up to the last 20 actions.

Edit > Redo

Image Removed

Copies and removes the currently selected data.

Edit > Cut

Image Removed

Copies the currently selected data.

Edit > Copy

--

Copies the currently selected object with each column header.

Edit > Copy with Headers

Image Removed

Pastes the highlighted data.

Edit > Paste

--

Selects all the data.

Edit > Select All

Image Removed

Clears all values of the current query.
 

Edit > Clear
 

--

Renames the currently selected field.

Edit > Rename

Image Removed

Removes the currently selected field.

Edit > Remove

Image Removed

Opens the properties dialog.

Edit > Properties

Image Removed

Turn descriptions on or off.

Data > Toggle Descriptions

Image Removed

Goes to the previous page of results.

Data > Previous

Image Removed

Goes to the next page of results.

Data > Next

Image Removed

Sorts the currently displayed segments in ascending order.

Data > Sort Ascending

Image Removed

Sorts the currently displayed segments in descending order.

Data > Sort Descending

Image Removed

Opens SQLManager.
 

Query > SQLManager
 

Image Removed

Opens the Filter window
 

Query > Filter
 

Image Removed

Opens the KPI Filter window.

Query > KPI Filter

Image Removed

Opens the Add Custom Field Dialog.

Query > Add Custom Field

Image Removed

Moves the highlighted field to the left (or up).

Query > Move Left

Image Removed

Moves the highlighted field to the right (or down).

Query > Move Right

Image Removed

Refreshes any cubes or tasks you are using.

Query > Refresh Cubes/Tasks

Image Removed

Opens the Export dialog to Export the query output.

Tools > Export

--

Tools > Open Reference

--

Opens drilldown dialog.

Tools > Drilldowns

--

Opens the Options dialog.

Tools > Options

Info
titleTool Tip

As a reminder of the icon's function, you may pause your mouse over each icon for a brief description of its use.

Constructing The Query

Constructing

Constructing a Query

Constructing a query only has a few simple steps, each of which are we outlined in further detail below the following basic instructions.

Tip
titleTo Construct a Query
  1. Open QueryBuilder.
  2. Select a table using SQLManager. Your query is based off your table selection in SQLManager. Double-click on the table or click 'OK' to open it in QueryBuilder. For more information on using SQLManager, please see the "SQLManager" section of this manual.
  3. Select the fields that you wish to include in your query through the The Select Fields Pane dialog on the left. For more information on this, please see "The Select Fields Pane" section later in this manual.
  4. Use a Filter to constrain your field information if necessary. For more information on using Filter, please see the "Filter" section earlier in this manual, and the "Using Filter to Construct a Query" section of this manual.
  5. Select the dimensions of Dimensions for your query. For more information, see "The Dimensions Pane" section of this manual.
  6. Sort the fields of your query. For more information, see The Sort Fields Pane section of this manual.
  7. If necessary, add a KPI filter.
  8. Click Submit ()
Note
titleNote

An additional method Another way to open the QueryBuilder module is to right click on a table you wish to work with in SQLManager and select ' QueryBuilder ' from the menu that appears. For more information on using SQLManager, please see "SQLManager" earlier in this manual.

Info
titleTime Saver

As a guide to using QueryBuilder, follow this sequence: After opening QueryBuilder and selecting your database and table with SQLManager, start with the Fields, then Filter, Dimensions, Sort Fields order, and finally your KPI Filter. Although selecting fields is the only necessary step to run a query, following this order for the additional optional steps can save you time, and keep your query free of errors.

Choosing a Table with QueryBuilder

QueryBuilder uses SQLManager for you to easily select a table to query. After opening QueryBuilder, clicking click on the SQLManager  () button will  icon to open SQLManager. Within SQLManager, you must then choose a table by selecting a clicking the table name and clicking then OK, or by double-clicking on the table name. SQLManager will close and the table's fields you selected will be shown at the left of appear in the Select Fields pane in the QueryBuilder window.

The Select Fields Pane

The Select Fields pane allows you to pick the fields that you want to use within your query. Drag and drop or double-click the fields you wish to include in your query. To select all the fields in a table, double click on the table name. These fields can be cleared easily by clicking Click the Clear () button to remove all of the selected fields.

Choosing 'Distinct'
  • Function – If you choose to attach a function to your field, you can select one from the
  • top left box
  • Function box above the Select Fields Pane. If you leave this option as <none>, then no function will be attached to this field. For instance, you can attach a Count
  • Occurrences function to the State field
  • function to the CustomerNumber field, which will count the number of
  • instances each state is listed.
  • customers that meet your queries criteria. 
  • Field – Here, simply choose a desired field from the
  • drop-down menu
  • list. A value for this area must be selected. Click on this area to select
  • from the drop-down menu
  • or move the fields.
  • Distinct
  • – This check-box option will make the query select only distinct fields.

Using Filter to Construct a Query 

Info
titleTool Tip
  • – Checking this box will filter out all repetitive instances of the value, leaving you with one sample of the potentially
numerous identical values.QueryBuilder uses the MarketWide Filter module to filter out values from your query. Clicking on Filter, or the Filter pane at the bottom of the QueryBuilder window, will open the Filter window. For more information on using Filter, please see the "Filter" section earlier in this manual.
  • many identical values

The Dimensions Pane

The Dimensions pane allows you to select which dimensions your query will display. Every field that you add will be displayed in your query. To add dimensions, simply drag the field from the field list, then drop the field in the dimension's column. These fields can be cleared easily by clicking the Clear (Image Removed) button.

The Sort Fields Pane

The sort field pane is located at the bottom right of QueryBuilder. Here, you can change the order or sorting of your fields, facilitating custom access to your data and orderly presentation. Simply select a field from the Select Fields Pane and drag it to the Sort Fields Pane. A field that has an up arrow will be sorted in ascending order, and one with a down arrow will be sorted in descending order. Again, these fields can be cleared easily by clicking the Clear (Image Removed) button.

Creating KPI Filters

KPI filters differ  differ from normal filters in that they allow you to filter on all of a customer's records at once rather than individually. This just the fields selected in the KPI or Dimension windows. This means that you can do add a filter on functions such things as summing up order amounts or other additional functions. KPI filters are also effective for eliminating outliers in a data set when retrieving the frequency. Essentiallyas the sum of a field must be greater than a particular value. Essentially, you are placing a function filter on a filterfunction.

KPI filters use the Filter module, and are essentially created in the same fashion as a normal filter. Clicking on the KPI Filter () button icon will open the KPI Filter dialog. For more information on using Filter, please see the "Filter" section earlier in this manual.

QueryBuilder Output

Column Properties

By right clicking over a field and picking Properties, you will open the Column Properties dialog. Some properties are editable and some are read only.

Another option available in QueryBuilder is to create your own custom field by selecting Add Custom Field... from the Query menu of the toolbar. When creating a custom field, you can specify the name of the field under Alias. Enter your own custom SQL code to define the field by clicking on the ellipses button under Custom Value.

QueryBuilder Results

Once you have finished constructing your query and have clicked the Submit (Image Modified) button, your QueryBuilder

Output

Results will be displayed in a new tab.

From here,

From the Results tab you can

save the data as an Excel document, Word document, or HTML document.

Options Dialog

This dialog, accessed through Tools > Options. Enable SQL options and set

review your data, change how your data is sorted or you can use DataExport to export your results. You can also return to the Query tab to make adjustment to your query if needed. 

Options Dialog

The Options Dialog allows you to set preferences for QueryBuilder. It provides options such as setting the maximum number of rows viewable on a page at a time. 

  • Enable Code Completion - In the SQL
Edit mode
  • window, as you type a command, MarketWide
will make
  • makes suggestions to complete the word you are typing. For example, if you were to type in the SELECT keyword, you would start with S and a list of database keywords that start with S would become visible to you. Likewise, SE would reveal all the database keywords that start with SE. You can select the desired option by using your arrow keys or by clicking
, you can select
  • one of the options in the drop-down list.
  • Word Wrap - A line of text will wrap onto the next line to fit the screen instead of continuing and requiring scrolling.
  • Parse AdHoc Query Changes - When this option is checked, SQL that is entered into the SQL Edit Mode is reflected in ListBox and Diagram mode.
  • Maximum rows -
The
  • This sets the maximum number of
result
  • rows to be displayed per page.

Column Properties

The Column Properties dialog allows show you the specifics of a chosen field. In already existing fields, some properties are editable and some are read only. When creating a custom field, however, you can specify the name of the field under Alias, and enter the SQL to define the field by clicking on the ellipses button.

Using Filter to Construct a Query 

QueryBuilder uses the MarketWide Filter module to filter out values from your query. Clicking on Filter (Image Added), or the Filter pane at the bottom of the QueryBuilder window, will open the Filter window. 

The Sort Fields Pane

In the Sort Fields pane, you can change the order your results appear by selecting a field or fields to sort by in ascending or descending order. Simply select a field from the Select Fields pane and drag it to the Sort Fields pane. A field that has an up arrow sorts in ascending order, and one with a down arrow will sort in descending order. 

Printing Output

MarketWide uses a standard print dialog to print query output. From the print dialog, you can access the Page Setup options.

Page Setup 
When printing QueryBuilder output, you can customize the format and settings of your output to enhance your reports. Adjusting scaling, changing fonts, adding dates, and margins, gives an abundance of presentation options.

Access the Page Setup dialog by clicking on File > Print from the menu in the QueryBuilder output, and then clicking File > Page Setup from the print preview page.

There are three main sections in the Page Setup dialog: Paper Size, Margins, and Orientation. 

    • Paper Size – In the Paper dialog, you can select the paper type and source. 
    • Orientation – The Orientation dialog allows you to choose either Portrait (vertical) or Landscape (horizontal) orientation. Landscape is particularly useful for wide report outputs.
    • Margins in Inches– In the Margins dialog, you can adjust page margins. A preview is displayed in the preview pane.

The QueryBuilder Menu and Toolbar

The toolbar gives quick access to commonly used commands in the QueryBuilder main window. Click the icon once to carry out the action it represents.

Icon

Description

Menu Equivalent

Image Added

Opens a new QueryBuilder window.

File > New

Image Added

Opens the Open Report dialog, allowing you to retrieve a saved query. 

File > Open

Image Added

Saves the open query.

File > Save

--

Allows you to select how and where the query is saved.

File > Save As

Image Added

Opens a query saved on your local machine.

File > Local > Open

Image Added

Saves the open query to your local machine.

File > Local > Save

Image Added

Submits your query for execution.

File > Submit

Image Added

Checks the syntax of the query and reports if it finds a problem.

File > Validate Query

Image Added

Opens the print dialog.

File > Print

Image Added

Allows you to sequentially undo up to the last 20 actions.

Edit > Undo

Image Added

Allows you to sequentially redo up to the last 20 actions.

Edit > Redo

Image Added

Copies and removes the selected data.

Edit > Cut

Image Added

Copies the selected data.

Edit > Copy

--

Copies the selected object with each column header.

Edit > Copy with Headers

Image Added

Pastes previously copied data.

Edit > Paste

--

Selects all the data.

Edit > Select All

Image Added

Clears all values of the current query.

Edit > Clear

--

Renames the selected field.

Edit > Rename

Image Added

Removes the selected field.

Edit > Remove

Image Added

Opens the properties dialog.

Edit > Properties

Image Added

Turn Descriptions on or off.

Data > Toggle Descriptions

Image Added

Goes to the previous page of results.

Data > Previous

Image Added

Goes to the next page of results.

Data > Next

Image Added

Sorts the selected column in ascending order.

Data > Sort Ascending

Image Added

Sorts the selected column in descending order.

Data > Sort Descending

Image Added

Opens SQLManager.

Query > SQLManager

Image Added

Opens the Filter window

Query > Filter

Image Added

Opens the KPI Filter window.

Query > KPI Filter

Image Added

Opens the Add Custom Field Dialog.

Query > Add Custom Field

Image Added

Moves the highlighted field to the left.

Query > Move Left

Image Added

Moves the highlighted field to the right.

Query > Move Right

Image Added

Refreshes any cubes or tasks you are using.

Query > Refresh Cubes/Tasks

Image Added

Opens the DataExport dialog to export your query results.

Tools > Export

--

Opens the file or hyperlink referenced in a field.

Tools > Open Reference

--

Opens Drilldown dialog.

Tools > Drilldowns

--

Opens the Options dialog.

Tools > Options