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 IModelDb.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: Code): Id64String | undefined

throws IModelError if the code is invalid

Parameter Type Description
code Code The code to look for

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

Defined in

Last Updated: 08 January, 2020