Skip to main content

Query Builder

The Query Builder in OctoMesh Refinery Studio allows you to create, save, and execute queries against your OctoMesh Runtime entities. It provides a visual interface for building queries without writing GraphQL code directly.

Accessing Query Builder

Navigate to Repository > Query Builder to access the query management interface.

Query Builder List

The list view shows all saved queries with their names and provides actions to edit or delete them.

Toolbar Actions

ButtonDescription
IMPORTImport queries from a file
NEW QUERYCreate a new query

Creating a New Query

Click NEW QUERY to open the query configuration form.

New Query Form

Query Configuration

The query form has several sections:

Basic Settings

FieldDescription
Query TypeSelect the type of query (Simple, Aggregation, or Grouped Aggregation)
Query NameA descriptive name for your query
CK TypeThe Construction Kit type to query

Query Types

Query Types

TypeDescription
Simple QueryReturns a list of entities with selected attributes
AggregationPerforms aggregate calculations (COUNT, SUM, AVG, MIN, MAX) on all matching entities
Grouped AggregationGroups entities by an attribute and performs aggregate calculations per group

Selecting a CK Type

Click the SELECT button next to the CK Type field to open the type selector.

CK Type Selector

The selector dialog shows all available Construction Kit types organized by package. Use the search field to filter types by name. Click on a type to select it.

Type Selected

After selection, the CK Type field shows the selected type (e.g., System.Identity/User).

Simple Query Configuration

For Simple Queries, you configure columns, sorting, and filters.

Columns

Click ADD COLUMNS to select which attributes to include in query results.

Columns Dialog

The column selection dialog shows:

  • Available attributes (left panel): All attributes from the selected CK Type with their data types
  • Selected columns (right panel): Attributes included in query results

Attribute types displayed include:

  • STRING - Text values
  • INTEGER - Whole numbers
  • INTEGER_64 - Large whole numbers
  • BOOLEAN - True/false values
  • DATE_TIME - Date and time values
  • DATE_TIME_OFFSET - Date and time with timezone
  • STRING_ARRAY - List of text values
  • RECORD_ARRAY - List of complex records

Columns Selected

Use the arrow buttons to:

  • Add selected attributes to the query
  • Remove attributes from the query
  • Reorder columns (move up/down)

Sorting

Add sorting rules to control the order of results:

  1. Click ADD SORTING
  2. Select the attribute to sort by
  3. Choose ascending or descending order

Multiple sort rules are applied in order.

Configured Query

Configured Query

Once columns are configured:

  • The SAVE button becomes enabled
  • The EXECUTE button becomes enabled
  • Column count is displayed (e.g., "4 Columns Selected")

Filters

Filters narrow down the query results based on attribute values.

Adding Filters

Click ADD FILTER to add a filter row.

Filter Row

Each filter consists of:

  • Attribute: The attribute to filter on
  • Operator: The comparison operator
  • Value: The value to compare against

Filter Attributes

Filter Attributes

The attribute dropdown shows all available attributes with their data types. The value input adapts based on the attribute type:

  • Boolean attributes show a toggle
  • String attributes show a text input
  • Number attributes show a numeric input
  • Date attributes show a date picker

Filter Operators

Filter Operators

OperatorDescription
EqualsExact match
Not EqualsDoes not match
Greater ThanValue is greater than
Greater EqualValue is greater than or equal to
Less ThanValue is less than
Less EqualValue is less than or equal to
LikePattern match (use % as wildcard)
InValue is in a list
Not InValue is not in a list
Any EqualsAny array element matches
Any LikeAny array element matches pattern
Match RegExRegular expression match

Multiple Filters

You can add multiple filters. All filters are combined with AND logic (all conditions must be true).

Aggregation Queries

Aggregation queries calculate summary statistics instead of returning individual entities.

Aggregation Query

For Aggregation queries, the COLUMNS and SORTING sections are replaced with an AGGREGATION section.

Configuring Aggregations

Click ADD AGGREGATION to open the aggregation dialog.

Aggregation Dialog

Configure each aggregation:

FieldDescription
FunctionThe aggregation function (COUNT, MIN, MAX, AVG, SUM)
AttributeThe attribute to aggregate (not needed for COUNT)
NameDisplay name for the aggregation result

Aggregation Functions

FunctionDescription
COUNTCount of matching entities
MINMinimum value
MAXMaximum value
AVGAverage (mean) value
SUMTotal sum of values

Grouped Aggregation Queries

Grouped Aggregation queries combine grouping with aggregation. Results are grouped by one attribute, and aggregations are calculated for each group.

Configuration includes:

  • Group By: The attribute to group results by
  • Aggregations: One or more aggregation functions

Example: Group users by department and count users per department.

Executing Queries

Click EXECUTE to run the query and see results. The results are displayed in a table format below the query configuration.

Saving Queries

Click SAVE to save the query configuration. Saved queries appear in the Query Builder list and can be:

  • Reused for data exploration
  • Referenced in MeshBoard widgets
  • Shared across the tenant

Best Practices

  1. Name queries descriptively: Use clear names that indicate what the query returns
  2. Use filters effectively: Narrow down results to improve performance
  3. Select only needed columns: Include only attributes you need to reduce data transfer
  4. Test before saving: Execute the query to verify results before saving
  5. Use aggregations for summaries: Use aggregation queries instead of fetching all data and calculating client-side
  6. Consider performance: Complex queries on large datasets may take longer to execute

Use Cases

Data Exploration

  • Browse entities of a specific type
  • Search for entities matching criteria
  • View entity attributes and relationships

Reporting

  • Count entities by status
  • Calculate averages and totals
  • Group and summarize data

Dashboard Data Sources

  • Create queries for MeshBoard widgets
  • Build reusable data extractions
  • Set up filtered views for specific use cases