Default property category override

TypeScript type: DefaultPropertyCategoryOverride.

A rule that allows overriding the default property category.

The default property category is a category that gets assigned to properties that otherwise have no category.

Attributes

Name Required? Type Default
Picking attributes
requiredSchemas No RequiredSchemaSpecification[] []
priority No number 1000
Content Modifiers
specification Yes PropertyCategorySpecification

Attribute: requiredSchemas

Lists ECSchema requirements that need to be met for the rule to take effect.

Type RequiredSchemaSpecification[]
Is Required No
Default Value []
// There's a content rule for returning content of given `bis.Subject` instance. In addition, there are two default
// property category overrides:
// - For iModels containing BisCore version 1.0.1 and older, the default property category should be "Custom Category OLD".
// - For iModels containing BisCore version 1.0.2 and newer, the default property category should be "Custom Category NEW".
const ruleset: Ruleset = {
  id: "example",
  rules: [
    {
      ruleType: "Content",
      specifications: [
        {
          specType: "SelectedNodeInstances",
        },
      ],
    },
    {
      ruleType: "DefaultPropertyCategoryOverride",
      requiredSchemas: [{ name: "BisCore", maxVersion: "1.0.2" }],
      specification: {
        id: "default",
        label: "Custom Category OLD",
      },
    },
    {
      ruleType: "DefaultPropertyCategoryOverride",
      requiredSchemas: [{ name: "BisCore", minVersion: "1.0.2" }],
      specification: {
        id: "default",
        label: "Custom Category NEW",
      },
    },
  ],
};

Example of using "required schemas" attribute

Attribute: priority

Controls rule priority. Because there can only be one default category, default category override with the highest priority value will override all other rules of the same type.

Type number
Is Required No
Default Value 1000
// There's a content rule for returning content of given `bis.Subject` instance. In addition, there are two default
// property category overrides of different priorities. The high priority rule should take precedence.
const ruleset: Ruleset = {
  id: "example",
  rules: [
    {
      ruleType: "Content",
      specifications: [
        {
          specType: "SelectedNodeInstances",
        },
      ],
    },
    {
      ruleType: "DefaultPropertyCategoryOverride",
      priority: 0,
      specification: {
        id: "default",
        label: "Low Priority",
      },
    },
    {
      ruleType: "DefaultPropertyCategoryOverride",
      priority: 9999,
      specification: {
        id: "default",
        label: "High Priority",
      },
    },
  ],
};

Example of using "priority" attribute

Attribute: specification

Specification for the custom property category.

Type PropertyCategorySpecification
Is Required Yes
// There's a content rule for returning content of given `bis.Subject` instance. In addition, there's a default property
// category override to place properties into.
const ruleset: Ruleset = {
  id: "example",
  rules: [
    {
      ruleType: "Content",
      specifications: [
        {
          specType: "SelectedNodeInstances",
        },
      ],
    },
    {
      ruleType: "DefaultPropertyCategoryOverride",
      specification: {
        id: "default",
        label: "Test Category",
      },
    },
  ],
};

Example of using "specification" attribute

Last Updated: 13 February, 2024