Skip to main content

runRecordQuery()

@gravity-rail/react


@gravity-rail/react / runRecordQuery

Function: runRecordQuery()

Call Signature​

runRecordQuery(client, query, mode?): Promise<RecordRowsResult>

Run a query over a Form's records on the server.

const page = await runRecordQuery(client, {
entity: 'data_record',
dataType: 'checkins',
where: { kind: 'compare', field: 'record.status', op: 'eq', value: 'open' },
sort: [{ field: 'record.createdAt', dir: 'desc' }],
limit: 20,
});
page.items; page.nextCursor;

Mode rows (the default for a query without aggregate) returns records and a cursor; count returns the number of matches; aggregate (the default when aggregate is set) returns the rolled-up rows. Rejects with RecordQueryError, or StepUpRequiredError when the platform asks for extra sign-in verification.

Parameters​

client​

Client

query​

RecordRowsQuery

mode?​

"rows"

Returns​

Promise<RecordRowsResult>

Call Signature​

runRecordQuery(client, query, mode): Promise<RecordCountResult>

Run a query over a Form's records on the server.

const page = await runRecordQuery(client, {
entity: 'data_record',
dataType: 'checkins',
where: { kind: 'compare', field: 'record.status', op: 'eq', value: 'open' },
sort: [{ field: 'record.createdAt', dir: 'desc' }],
limit: 20,
});
page.items; page.nextCursor;

Mode rows (the default for a query without aggregate) returns records and a cursor; count returns the number of matches; aggregate (the default when aggregate is set) returns the rolled-up rows. Rejects with RecordQueryError, or StepUpRequiredError when the platform asks for extra sign-in verification.

Parameters​

client​

Client

query​

RecordRowsQuery

mode​

"count"

Returns​

Promise<RecordCountResult>

Call Signature​

runRecordQuery(client, query, mode?): Promise<RecordAggregateResult>

Run a query over a Form's records on the server.

const page = await runRecordQuery(client, {
entity: 'data_record',
dataType: 'checkins',
where: { kind: 'compare', field: 'record.status', op: 'eq', value: 'open' },
sort: [{ field: 'record.createdAt', dir: 'desc' }],
limit: 20,
});
page.items; page.nextCursor;

Mode rows (the default for a query without aggregate) returns records and a cursor; count returns the number of matches; aggregate (the default when aggregate is set) returns the rolled-up rows. Rejects with RecordQueryError, or StepUpRequiredError when the platform asks for extra sign-in verification.

Parameters​

client​

Client

query​

RecordAggregateQuery

mode?​

"aggregate"

Returns​

Promise<RecordAggregateResult>

Call Signature​

runRecordQuery(client, query, mode?): Promise<RecordRowsResult | RecordCountResult | RecordAggregateResult>

Run a query over a Form's records on the server.

const page = await runRecordQuery(client, {
entity: 'data_record',
dataType: 'checkins',
where: { kind: 'compare', field: 'record.status', op: 'eq', value: 'open' },
sort: [{ field: 'record.createdAt', dir: 'desc' }],
limit: 20,
});
page.items; page.nextCursor;

Mode rows (the default for a query without aggregate) returns records and a cursor; count returns the number of matches; aggregate (the default when aggregate is set) returns the rolled-up rows. Rejects with RecordQueryError, or StepUpRequiredError when the platform asks for extra sign-in verification.

Parameters​

client​

Client

query​

RecordQuery

mode?​

RecordQueryMode

Returns​

Promise<RecordRowsResult | RecordCountResult | RecordAggregateResult>