Skip to main content

Create a Basic Query Factory

  1. Open the Configuration Editor for your RISKSHEET document
  2. Navigate to the Query Factories section
  3. Add a new query factory definition:
"queryFactories": {
  "filterBySoE": {
    "description": "Filter Hazardous Situations by selected System of Equipment",
    "query": "linkedWorkItems.id:{{soeColumn}}"
  }
}
  1. Reference the query factory in your column configuration:
"columns": [
  {
    "id": "hazSituation",
    "header": "Hazardous Situation",
    "dataType": "itemLink",
    "binding": "hazardousSituation",
    "itemType": "hazard",
    "queryFactory": "filterBySoE"
  }
]
  1. Save the configuration and reload the RISKSHEET
Query factories support {{columnId}} placeholders that are replaced with the current row’s value for that column at runtime. This enables dynamic filtering based on user selections.
Create a two-column dependency where selecting a parent item filters available child items:
"columns": [
  {
    "id": "systemOfEquipment",
    "header": "System of Equipment",
    "dataType": "itemLink",
    "binding": "soe",
    "itemType": "system"
  },
  {
    "id": "hazSituation",
    "header": "Hazardous Situation",
    "dataType": "itemLink",
    "binding": "hazardousSituation",
    "itemType": "hazard",
    "queryFactory": "filterBySoE",
    "canCreate": false
  }
],
"queryFactories": {
  "filterBySoE": {
    "query": "linkedWorkItems.id:{{systemOfEquipment}} AND type:hazard"
  }
}

Query Factory Data Flow

diagram

Disable Item Creation in Filtered Columns

When using query factories, you typically want to prevent users from creating new items that might violate the filter:
{
  "id": "filteredColumn",
  "dataType": "itemLink",
  "queryFactory": "myFilter",
  "canCreate": false
}
Setting canCreate: false removes the ‘Add new item’ option from the autocomplete dropdown.

Advanced Pattern: Multi-Level Filtering

Chain multiple dependent columns for hierarchical filtering:
"columns": [
  {
    "id": "productLine",
    "header": "Product Line",
    "dataType": "enum",
    "binding": "productLine"
  },
  {
    "id": "systemOfEquipment",
    "header": "System",
    "dataType": "itemLink",
    "binding": "soe",
    "itemType": "system",
    "queryFactory": "filterByProductLine",
    "canCreate": false
  },
  {
    "id": "hazSituation",
    "header": "Hazard",
    "dataType": "itemLink",
    "binding": "hazard",
    "itemType": "hazard",
    "queryFactory": "filterBySystem",
    "canCreate": false
  }
],
"queryFactories": {
  "filterByProductLine": {
    "query": "customFields.productLine:{{productLine}}"
  },
  "filterBySystem": {
    "query": "linkedWorkItems.id:{{systemOfEquipment}}"
  }
}
This creates a three-level hierarchy: Product Line → System → Hazard, where each selection filters the next column.
If the parent column value is empty or null, the query factory placeholder will be replaced with an empty string, potentially causing the autocomplete to show all items. Consider adding validation or user guidance to ensure parent columns are populated first.
Query factories execute on every autocomplete request. Complex queries or queries against large datasets may impact autocomplete response time. Test performance with realistic data volumes.

Common Use Cases

Use CaseQuery Factory PatternExample
Filter by upstream linklinkedWorkItems.id:{{parentColumn}}Show mitigations linked to selected risk
Filter by custom field matchcustomFields.fieldName:{{columnId}}Show items with matching category
Filter by type and relationshiptype:hazard AND linkedWorkItems.id:{{soe}}Show hazards for selected system
Cross-project filteringproject:{{projectColumn}} AND type:requirementShow requirements from selected project

Verification

After configuring your query factory:
  1. Open a cell in the column using the query factory
  2. Select a value in the parent/dependency column
  3. Click into the filtered column
  4. Start typing to trigger autocomplete
You should now see only autocomplete suggestions that match the current row’s context based on your query factory filter.

See Also

Support TicketsSource Code
  • AppConfig.ts
  • MultiItemLinkEditor.ts
  • TextEditor.ts
  • CellEditorFormatter.ts
  • QueryBuilder.java