> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usehasp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Example: Inventory Tracker

> Inventory management with number fields, boolean filters, category filtering, and bulk stocktake updates.

An inventory management app demonstrating `number` and `boolean` fields, category filtering, and `bulkUpdateRecords` for stocktake adjustments.

## Schema

**Entity:** Items — key: `items`

| Field            | Type     | Notes                                                 |
| ---------------- | -------- | ----------------------------------------------------- |
| `name`           | text     | required                                              |
| `sku`            | text     | required                                              |
| `category`       | select   | electronics / furniture / supplies / other — required |
| `quantity`       | number   | required, min: 0                                      |
| `unit_price`     | number   | min: 0                                                |
| `location`       | text     |                                                       |
| `is_low_stock`   | boolean  |                                                       |
| `last_restocked` | date     |                                                       |
| `notes`          | textarea |                                                       |

## Key Patterns

### Boolean Filter

```javascript theme={null}
// Low stock only
filter.is_low_stock = { eq: true };

// In stock only
filter.is_low_stock = { eq: false };
```

### Number Field Handling

Always convert form input strings to numbers before sending to the SDK — form inputs return strings even for `type="number"`:

```javascript theme={null}
quantity: document.getElementById('quantity').value !== ''
  ? Number(document.getElementById('quantity').value)
  : null,
```

### Bulk Stocktake Adjustment

Update multiple items at once after a stocktake. Check `result.error` per batch to handle partial failures:

```javascript theme={null}
const adjustments = [
  { id: '01JA...', data: { quantity: 45, is_low_stock: false } },
  { id: '01JB...', data: { quantity: 3,  is_low_stock: true  } },
  { id: '01JC...', data: { quantity: 0,  is_low_stock: true  } },
];

const result = await sdk.bulkUpdateRecords('items', adjustments);

if (result.error) {
  console.warn('Some updates failed:', result.error.details);
}
```

### Low-Stock Indicator

```javascript theme={null}
const qtyClass = item.is_low_stock ? 'low' : 'ok';
// render: <span class="qty low">3 <span class="low-badge">LOW</span></span>
```
