For the complete documentation index, see llms.txt. This page is also available as Markdown.

EntityToQuery

Convert an entity or array of entities to a Query object.

The query holds one row per entity and one column per id, column, version and timestamp property, inherited ones included.

Method Signature

EntityToQuery(entity=[Any], name=[Any])

Arguments

Argument
Type
Required
Description
Default

entity

Any

true

An instance of an ORM entity or an array of entities. All entities in an array must be of the same type.

name

Any

false

The name of the entity. Inferred from the (first) entity when omitted. Useful to pick the entity with inheritance.

Examples

Convert a Single Entity

Pass one loaded entity to get a single-row query result.

result = entityToQuery( entityLoadByPK( "Vehicle", "1HGCM82633A123456" ), "Vehicle" );

Convert an Entity Array

Pass an array of entities to get one row per entity.

You can also omit the entity name and let the function infer it from the entity type:

Note that for performance reasons we recommend passing the entity name explicitly.

See Entities as Queries for the full guide.

Last updated

Was this helpful?