---
title: "Examples"
slug: "examples"
abstract: "Examples of how to implement an external component."
---
# Examples

The following examples are designed to help you understand and implement external page components:

- [Display logs](https://doc.sitecore.com/ch/en/users/content-hub/display-logs.html "Display logs")
- [Use the SearchRequest method](https://doc.sitecore.com/ch/en/users/content-hub/use-the-searchrequest-method.html "Use the SearchRequest method")
- [Load an entity](https://doc.sitecore.com/ch/en/users/content-hub/load-an-entity.html "Load an entity")
- [Show Content Hub icons](https://doc.sitecore.com/ch/en/users/content-hub/show-content-hub-icons.html "Show Content Hub icons")
- [Use an external component action inside a search](https://doc.sitecore.com/ch/en/users/content-hub/use-an-external-component-action-inside-a-search.html "Use an external component action inside a search")
- [Use notifier events](https://doc.sitecore.com/ch/en/users/content-hub/use-notifier-events.html "Use notifier events")
- [Use a search event](https://doc.sitecore.com/ch/en/users/content-hub/use-a-search-event.html "Use a search event")
- [Use a selection event](https://doc.sitecore.com/ch/en/users/content-hub/use-a-selection-event.html "Use a selection event")
- [Use subscribing events](https://doc.sitecore.com/ch/en/users/content-hub/use-subscribing-events.html "Use subscribing events")

For all examples, types are imported from the SDK:

```csharp
import {
    FieldFilterRequestResource,
    FilterOperator,
    RequestedFilterType,
} from "@sitecore/sc-contenthub-webclient-sdk";

```

The following table provides code examples for filtering:

- Filter: Code example
- Filter on one or more entity IDs:

```csharp
new FieldFilterRequestResource({
    filterType: RequestedFilterType.IdFilter,
    fieldName: "Id",
    operator: FilterOperator.AnyOf,
    values: [1, 2, 3],
    hidden: true,
    multiSelect: false,
    visible: true,
})

```

- Get all entities from the specified definition:

```csharp
new FieldFilterRequestResource({
    fieldName: "definitionName",
    operator: FilterOperator.AnyOf,
    filterType: RequestedFilterType.InFilter,
    values: ["M.Asset"],
    hidden: true,
    multiSelect: false,
    visible: true,
}

```

- Filter on a string property: NoteAlso available: operator: FilterOperator.DoesNotEqual

```csharp
new FieldFilterRequestResource({
    filterType: RequestedFilterType.FieldFilter,
    operator: FilterOperator.Equals,
    fieldName: "Status",
    values: ["Active"],
})

```

- Filter on a Boolean property: NoteAlso available: operator: FilterOperator.DoesNotEqual (for example, to get all entities where the boolean is false or null (not set)).

```csharp
new FieldFilterRequestResource({
    definitionName: "M.AssetMedia",
    filterType: RequestedFilterType.FieldFilter,
    fieldName: "IsOrderingCategory",
    operator: FilterOperator.Equals,
    values: [true],
    visible: true,
})

```

- Filter on entities where the specified relation is not filled in (that is, it is missing).: NoteYou can also filter on entities where the relation is filled in using FilterOperator.Exists. Other fieldName options include "ancestors.*.somerelationname.ancestor_ids", "taxonomy_items.98.children", and "taxonomy_items.98.*".

```csharp
new FieldFilterRequestResource({
    filterType: RequestedFilterType.FieldFilter,
    fieldName: "relations.SomeRelationName.parents",
    operator: FilterOperator.Missing,
    values: [null],
    hidden: true,
    multiSelect: false,
    visible: true,
}

```

- Filter on entities that have a relation with any entity 1, 2, 3 (`FilterOperator.AnyOf`)Filter on entities that have a relation with all entities 1, 2, 3 (`FilterOperator.AllOf`):

```csharp
new FieldFilterRequestResource({
    fieldName: "relations.SomeRelationName.parents",
    operator: FilterOperator.AnyOf,
    filterType: RequestedFilterType.InFilter,
    values: [1, 2, 3],
    hidden: true,
    multiSelect: false,
    role: null, // needs to be defined for self relations! "Parent" or "Child"
    visible: true,
})

```

> [!note]
> To help you implement external page components, [code samples](https://content.stylelabs.cloud/api/public/content/aa3086be8d50480e997e0682cb40e4db?v=b335d8c3) are also available.