Standards Docs
ReferenceSchema

rollup

Create a rollup attribute builder

Create a rollup attribute builder

Signature

<TName extends string>(config: TypedBuilderConfig<TName>): RollupAttributeBuilder<TName>

Examples

Sum of related amounts
```typescript
rollup({ name: "totalOrders", label: "Total Orders" })
.from("orders")           // relation attribute name
.aggregate("amount")      // target attribute to sum
.using("sum")
.decimals(2)

```ts
Count of related records
```typescript
rollup({ name: "orderCount", label: "Number of Orders" })
.from("orders")
.aggregate("id")          // any attribute works for count
.using("count")

```ts
Display original values with their type (select/status as tags)
```typescript
rollup({ name: "companyStatus", label: "Company Status" })
.from("company")
.aggregate("status")
.using("original")
.targetType("status")
.targetOptions([
{ id: "active", label: "Active", value: "active", color: "green" },
{ id: "inactive", label: "Inactive", value: "inactive", color: "red" }
])

On this page