queryElementIdByCode Method

Query for the Id of the element that has a specified code. This method is for the case where you know the element's Code. If you only know the code value, then in the simplest case, you can query on that and filter the results. In the simple case, call queryEntityIds, specifying the code value in the where clause of the query params. Or, you can execute an ECSQL select statement. See frequently used ECSQL queries for an example.

queryElementIdByCode(code: Required<CodeProps>): undefined | string

@returns The element that uses the code or undefined if the code is not used.

@throws IModelError if the code is invalid

Parameter Type Description
code Required<CodeProps> The code to look for

Returns - undefined | string

The element that uses the code or undefined if the code is not used.

Defined in

Last Updated: 17 December, 2024