Lime Web Components API Documentation - v7.4.0
    Preparing search index...

    Interface ObjectResponse

    Response from loading objects via LimeObjectRepository.

    Contains the objects that matched the query, along with count information and any requested aggregate calculations. Used by LimeObjectRepository.loadObjects and LimeObjectRepository.loadRelations. Free-text search returns a SearchResponse instead.

    The response provides:

    • objects - The actual data records that matched the query
    • totalCount - Total number of matching objects (for pagination)
    • totalRelations - Total count without filters (only for loadRelations)
    • aggregates - Calculated statistics grouped by criteria
    import { Operator, PlatformServiceName } from '@limetech/lime-web-components';

    const repository = platform.get(PlatformServiceName.LimeObjectRepository);
    const pageSize = 25;

    const response = await repository.loadObjects('deal', {
    filter: { key: 'status', op: Operator.EQUALS, exp: 'active' },
    limit: pageSize,
    offset: 0,
    });

    console.log(
    `Showing ${response.objects.length} of ${response.totalCount} deals`
    );

    const totalPages = Math.ceil(response.totalCount / pageSize);
    interface ObjectResponse {
        aggregates?: AggregationGroups;
        objects: LimeObjectRecord[];
        totalCount: number;
        totalRelations?: number;
    }
    Index

    Properties

    aggregates?: AggregationGroups

    Aggregated calculation results grouped by criteria.

    Contains the results of aggregate operations (COUNT, SUM, AVG, MAX, MIN) requested via AggregateProperty in the query properties. Results are organized by group name, with each group containing an array of aggregation values.

    import {
    AggregateOperator,
    PlatformServiceName,
    } from '@limetech/lime-web-components';

    const repository = platform.get(PlatformServiceName.LimeObjectRepository);

    const response = await repository.loadObjects('deal', {
    properties: [
    'name',
    {
    name: 'value',
    key: 'total_value',
    operator: AggregateOperator.Sum,
    },
    {
    name: 'value',
    key: 'avg_value',
    operator: AggregateOperator.Average,
    },
    ],
    });

    // Both aggregates share the `default` group, one key each.
    const defaultGroup = response.aggregates?.['default']?.[0];
    const totalValue = defaultGroup?.['total_value'];
    const avgValue = defaultGroup?.['avg_value'];
    objects: LimeObjectRecord[]

    Array of objects that matched the query.

    Each object contains the properties specified in LoadOptions.properties, or all properties if none were specified. The length may be less than totalCount when using limit/offset for pagination.

    Note: The type is object[] rather than LimeObject[]. In practice the objects behave like LimeObject instances (with getValue(), id, etc.), but the type is intentionally loose here.

    totalCount: number

    Total number of objects that match the query filter.

    This count reflects the total number of objects matching the filter, regardless of the limit parameter. Use this for pagination calculations.

    import { PlatformServiceName } from '@limetech/lime-web-components';

    const repository = platform.get(PlatformServiceName.LimeObjectRepository);
    const pageSize = 25;

    const response = await repository.loadObjects('deal', { limit: pageSize });

    const totalPages = Math.ceil(response.totalCount / pageSize);
    const hasMore = response.objects.length < response.totalCount;
    totalRelations?: number

    Total number of related objects without any filter applied.

    Only present in responses from LimeObjectRepository.loadRelations. Represents the total count of all related objects, ignoring the filter but respecting the relationship. Use this to show "X of Y total relations".

    import { Operator, PlatformServiceName } from '@limetech/lime-web-components';

    const repository = platform.get(PlatformServiceName.LimeObjectRepository);
    const companyId = 456;

    const response = await repository.loadRelations('company', companyId, 'deals', {
    filter: { key: 'status', op: Operator.EQUALS, exp: 'active' },
    });

    console.log(`${response.totalCount} active deals`);
    console.log(`${response.totalRelations} total deals for this company`);