---
title: QidSet
summary: Class in @bimworks/jssdk.
order: 10
languages: [javascript]
sdk-package: JavaScript · @bimworks/jssdk
---

# QidSet

[[page:reference/javascript/api|API catalogue]] · `@bimworks/jssdk` · Class

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
class QidSet
````

QidSet represents a Set of [[page:reference/javascript/bimworks-jssdk/qid-7ed065a1|Qid]]. The main reasons why this class exists and should be used are:
- A regular Set can not handle custom objects such as Qid
- The internal implementation of QidSet is a lot more efficient than a generic Set object (it can do so because it is aware of what type is stored)

This object is Set-like (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#set-like_objects)

The methods on this class are also as much as possible identical to that of the built-in Set class.

## Members

| Member | Kind | Description |
|---|---|---|
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-constructor-637d368034cb|constructor]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-constructor-bc55c4f36029|constructor]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-first-093df667fe7f|first]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-size-d6974643528f|size]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-empty-447e7b280092|empty]] | Method | Returns a reference to an empty QidSet which should be regarded a unmodifiable. This can be used to avoid allocations. |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-iterator-b329f577ddd3|&#91;iterator&#93;]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-add-4ad70037d0fa|add]] | Method | Add a Qid to this set |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-addall-44a7df4269e6|addAll]] | Method | Add all the Qids of the given QidSet to this QidSet |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-addbyvidoid-692b4daab146|addByVidOid]] | Method | Add a Qid to this set. This method does the same thing as the add(qid) method but can be slightly more efficient in cases where no Qid is available |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-clear-6d2987e216fb|clear]] | Method | Remove all Qids from this QidSet |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-clone-dcfe03d765c8|clone]] | Method | A copy of this set |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-delete-0a9033f83a90|delete]] | Method | Remove a Qid from this QidSet |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-difference-338fa60f78b6|difference]] | Method | The difference() method of QidSet instances takes a QidSet and returns a new QidSet containing elements in this QidSet but not in the given QidSet. |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-dispose-5bc3cee1ea18|dispose]] | Method | Releases the bitmap memory (WebAssembly) behind this set; the set must not be used afterwards |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-entries-9536185a7213|entries]] | Method | The entries() method of QidSet instances returns a new set iterator object that contains an array of [qid, qid] for each element in this set. For QidSet obje… |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-filter-73bbb91af51f|filter]] | Method | Create a new QidSet by filtering the current QidSet. |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-foreach-6f5d48889bbe|forEach]] | Method | The forEach() method of QidSet instances executes a provided function once for each Qid in this set |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-getversionuuidset-c787f06c5a99|getVersionUuidSet]] | Method | A convenience method that extracts all the unique Vid's of the Qids in this QidSet |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-has-770b98568066|has]] | Method | Check whether this QidSet contains the given Qid |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-hasvidoid-a7b0fc8af537|hasVidOid]] | Method | Whether the set holds the object `oid` of version `vid` |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-intersection-584afc3995ce|intersection]] | Method | Calculate the intersection of two QidSets; All Qid's that are in both QidSet. |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-isempty-5427304a9900|isEmpty]] | Method |  |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-keys-8eeddab05e7b|keys]] | Method | The keys() method of QidSet instances is an alias for the values() method. |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-renamevid-8e386d7515aa|renameVid]] | Method | Moves the objects of version `oldVid` to `newVid`, for example after a version was replaced by its successor |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-splitbyvid-da917aab5331|splitByVid]] | Method | This set split per version: each subset holds only that version's objects |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-toparametervalue-4aa8e00e16c5|toParameterValue]] | Method | The plain-JSON form the server binds as a query parameter (see QueryHelper.toParameterValues) |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-toqidcondition-d1f10ed0af54|toQidCondition]] | Method | Generate a string that can be used in a BQL condition Example use: "buildingStorey.qid " + floorQids.toQidCondition() + " AND type != IFCSPACE" |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-toquotedstring-3012cef839f0|toQuotedString]] | Method | Generates a string representation of this QidSet in the form of a comma-separated and per-Qid double-quoted string Example: A QidSet with 2 QIDs would be rep… |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-union-bc330b68e396|union]] | Method | Union two QidSets |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-unioninline-285435d71fc3|unionInline]] | Method | Union two QidSets, this QidSet is modified |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-values-f5ad30e46672|values]] | Method | The values() method of QidSet instances returns a new set iterator object that contains the values for each element in this set. |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-of-2922b1b2dc30|of]] | Method | A new set holding one Qid |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-ofalt-f42aa04504f5|ofAlt]] | Method | A set of the objects given per model, {versionUuid: oids}: the form API results (a BVL result's show, hide, select ...) send object sets in |
| [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e#member-ofiterable-c963c6a53b75|ofIterable]] | Method | Create a new QidSet by providing an Iterable, the values in the Iterable must be either: - Valid Qid Strings - Qid instances - JS Objects that have both the … |

## `constructor` {#member-constructor-637d368034cb}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
constructor()
````



## `constructor` {#member-constructor-bc55c4f36029}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
constructor(iterable: Iterable<Qid>)
````



### Parameters

| Name | Type | Description |
|---|---|---|
| `iterable` | `Iterable<Qid>` |  |

## `first` {#member-first-093df667fe7f}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
first(): Qid
````



### Returns

The first Qid in this QidSet. Keep in mind that order in a QidSet is not guaranteed thus this method really should only be used in cases where the QidSet is of size 1

## `size` {#member-size-d6974643528f}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
size(): number
````



### Returns

The current size of this QidSet (number of Qids in it)

## `empty` {#member-empty-447e7b280092}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
static empty(): QidSet
````

Returns a reference to an empty QidSet which should be regarded a unmodifiable. This can be used to avoid allocations.

## `[iterator]` {#member-iterator-b329f577ddd3}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
[iterator](): IterableIterator<Qid>
````



## `add` {#member-add-4ad70037d0fa}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
add(qid: Qid): boolean
````

Add a Qid to this set

### Parameters

| Name | Type | Description |
|---|---|---|
| `qid` | [[page:reference/javascript/bimworks-jssdk/qid-7ed065a1|Qid]] | The Qid to add |

### Returns

Whether the Qid was added, only returns false when the Qid was already in the set

## `addAll` {#member-addall-44a7df4269e6}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
addAll(qids: QidSet): number
````

Add all the Qids of the given QidSet to this QidSet

### Parameters

| Name | Type | Description |
|---|---|---|
| `qids` | [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e|QidSet]] | Another QidSet |

### Returns

The number of Qids that were added (already existing ones not counted)

## `addByVidOid` {#member-addbyvidoid-692b4daab146}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
addByVidOid(vid: string, oid: number): boolean
````

Add a Qid to this set. This method does the same thing as the add(qid) method but can be slightly more efficient in cases where no Qid is available

### Parameters

| Name | Type | Description |
|---|---|---|
| `vid` | `string` | The Vid (Version UUID) |
| `oid` | `number` | The Oid (Object ID) |

### Returns

Whether the Qid was added, only returns false when the Qid was already in the set

## `clear` {#member-clear-6d2987e216fb}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
clear(): void
````

Remove all Qids from this QidSet

## `clone` {#member-clone-dcfe03d765c8}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
clone(): QidSet
````

A copy of this set

## `delete` {#member-delete-0a9033f83a90}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
delete(qid: Qid): boolean
````

Remove a Qid from this QidSet

### Parameters

| Name | Type | Description |
|---|---|---|
| `qid` | [[page:reference/javascript/bimworks-jssdk/qid-7ed065a1|Qid]] | The Qid to remove |

### Returns

Whether the Qid was removed, returns false when the Qid did not exist in the QidSet

## `difference` {#member-difference-338fa60f78b6}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
difference(other: QidSet): QidSet
````

The difference() method of QidSet instances takes a QidSet and returns a new QidSet containing elements in this QidSet but not in the given QidSet.

### Parameters

| Name | Type | Description |
|---|---|---|
| `other` | [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e|QidSet]] | The other QidSet to subtract |

## `dispose` {#member-dispose-5bc3cee1ea18}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
dispose(): void
````

Releases the bitmap memory (WebAssembly) behind this set; the set must not be used afterwards

## `entries` {#member-entries-9536185a7213}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
entries(): Iterator<Qid, Qid, QidSet>
````

The entries() method of QidSet instances returns a new set iterator object that contains an array of [qid, qid] for each element in this set. For QidSet objects there is no key like in QidMap objects. However, to keep the API similar to the QidMap object, each entry has the same value for its key and value here, so that an array [qid, qid] is returned.

## `filter` {#member-filter-73bbb91af51f}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
filter(callbackFn?: (qid: Qid) => boolean): QidSet
````

Create a new QidSet by filtering the current QidSet.

### Parameters

| Name | Type | Description |
|---|---|---|
| `callbackFn` | `(qid: Qid) => boolean` | A function that should return true for elements that should be included, when no callbackFn is passed all Qids will be included |

### Returns

A new QidSet with the filtered Qids

## `forEach` {#member-foreach-6f5d48889bbe}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
forEach(callbackFn: (qid: Qid) => boolean, thisArg?: unknown): void
````

The forEach() method of QidSet instances executes a provided function once for each Qid in this set

### Parameters

| Name | Type | Description |
|---|---|---|
| `callbackFn` | `(qid: Qid) => boolean` |  |
| `thisArg` | `unknown` |  |

## `getVersionUuidSet` {#member-getversionuuidset-c787f06c5a99}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
getVersionUuidSet(): Set<string>
````

A convenience method that extracts all the unique Vid's of the Qids in this QidSet

### Returns

A Set containing the unqiue Vid's in this QidSet

## `has` {#member-has-770b98568066}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
has(qid: Qid): boolean
````

Check whether this QidSet contains the given Qid

### Parameters

| Name | Type | Description |
|---|---|---|
| `qid` | [[page:reference/javascript/bimworks-jssdk/qid-7ed065a1|Qid]] | The Qid to check |

### Returns

Whether this QidSet contains the given Qid

## `hasVidOid` {#member-hasvidoid-a7b0fc8af537}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
hasVidOid(vid: string, oid: number): boolean
````

Whether the set holds the object `oid` of version `vid`

### Parameters

| Name | Type | Description |
|---|---|---|
| `vid` | `string` |  |
| `oid` | `number` |  |

## `intersection` {#member-intersection-584afc3995ce}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
intersection(other: QidSet): QidSet
````

Calculate the intersection of two QidSets; All Qid's that are in both QidSet.

### Parameters

| Name | Type | Description |
|---|---|---|
| `other` | [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e|QidSet]] | The other QidSet |

### Returns

A new QidSet with the intersection of this QidSet and the other QidSet

## `isEmpty` {#member-isempty-5427304a9900}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
isEmpty(): boolean
````



## `keys` {#member-keys-8eeddab05e7b}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
keys(): Iterator<Qid, Qid, QidSet>
````

The keys() method of QidSet instances is an alias for the values() method.

## `renameVid` {#member-renamevid-8e386d7515aa}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
renameVid(oldVid: string, newVid: string): void
````

Moves the objects of version `oldVid` to `newVid`, for example after a version was replaced by its successor

### Parameters

| Name | Type | Description |
|---|---|---|
| `oldVid` | `string` |  |
| `newVid` | `string` |  |

## `splitByVid` {#member-splitbyvid-da917aab5331}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
splitByVid(): Map<string, QidSet>
````

This set split per version: each subset holds only that version's objects

## `toParameterValue` {#member-toparametervalue-4aa8e00e16c5}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
toParameterValue(): ({ oids: (number)[]; vid: string })[]
````

The plain-JSON form the server binds as a query parameter (see `QueryHelper.toParameterValues`)

## `toQidCondition` {#member-toqidcondition-d1f10ed0af54}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
toQidCondition(): string
````

Generate a string that can be used in a BQL condition

Example use: "buildingStorey.qid " + floorQids.toQidCondition() + " AND type != IFCSPACE"

## `toQuotedString` {#member-toquotedstring-3012cef839f0}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
toQuotedString(allowCompact?: boolean): string
````

Generates a string representation of this QidSet in the form of a comma-separated and per-Qid double-quoted string

Example: A QidSet with 2 QIDs would be represented as: "227e071d-4909-4b5c-8d48-46f44d027c46-1", "227e071d-4909-4b5c-8d48-46f44d027c46-2"

The returned String is usually used to plug into a String representation of a BQL (BIM.works Query Language) query, for example:

GET attribute.Name WHERE qid IN ("227e071d-4909-4b5c-8d48-46f44d027c46-1", "227e071d-4909-4b5c-8d48-46f44d027c46-2")

When allowCompact is enabled the same QidSet would be represented as: "227e071d-4909-4b5c-8d48-46f44d027c46"[1, 2], which is also valid in a BQL query

### Parameters

| Name | Type | Description |
|---|---|---|
| `allowCompact` | `boolean` | Whether the implementation is allowed to use the compact representation, defaults to true |

### Returns

A String representation of this QidSet

## `union` {#member-union-bc330b68e396}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
union(other: QidSet): QidSet
````

Union two QidSets

### Parameters

| Name | Type | Description |
|---|---|---|
| `other` | [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e|QidSet]] |  |

### Returns

A new QidSet object containing elements which are in either this QidSet or in the other QidSet.

## `unionInline` {#member-unioninline-285435d71fc3}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
unionInline(other: QidSet): QidSet
````

Union two QidSets, this QidSet is modified

### Parameters

| Name | Type | Description |
|---|---|---|
| `other` | [[page:reference/javascript/bimworks-jssdk/qidset-48ad2c6e|QidSet]] |  |

### Returns

This QidSet object containing elements which are in either this QidSet or in the other QidSet.

## `values` {#member-values-f5ad30e46672}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
values(): Iterator<Qid, Qid, QidSet>
````

The values() method of QidSet instances returns a new set iterator object that contains the values for each element in this set.

## `of` {#member-of-2922b1b2dc30}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
static of(qid: string | Qid): QidSet
````

A new set holding one Qid

### Parameters

| Name | Type | Description |
|---|---|---|
| `qid` | `string \| Qid` |  |

## `ofAlt` {#member-ofalt-f42aa04504f5}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
static ofAlt(qids: { [versionUuid: string]: Iterable<number, any, any> }): QidSet
````

A set of the objects given per model, {versionUuid: oids}: the form API results (a BVL result's
show, hide, select ...) send object sets in

### Parameters

| Name | Type | Description |
|---|---|---|
| `qids` | `{ [versionUuid: string]: Iterable<number, any, any> }` |  |

## `ofIterable` {#member-ofiterable-c963c6a53b75}

````typescript sdk=js sdk-namespace="@bimworks/jssdk"
static ofIterable(iterable: Iterable<string | object | Qid>): QidSet
````

Create a new QidSet by providing an Iterable, the values in the Iterable must be either:
- Valid Qid Strings
- Qid instances
- JS Objects that have both the vid:string and oid:number properties

### Parameters

| Name | Type | Description |
|---|---|---|
| `iterable` | `Iterable<string \| object \| Qid>` |  |

### Returns

A QidSet of all the Qids in the Iterable
