qobrix_top_records
Fetch top-N rows from any resource sorted by a numeric or ISO-date field, with foreign keys resolved to readable names. Handles full-dataset rankings and nullable/computed fields.
Instructions
Top-N rows of any resource sorted by a numeric or ISO-date field. Paginates server-side (cap 20,000 rows), sorts in-process, and resolves common FK fields (property_id, agent, owner, assigned_to, commission_to, commission_to_2, contact_name, salesperson, seller, project, developer_id, campaign_id) into readable names so the agent doesn't have to chain lookups. Use this for full-dataset top-N, or when list/search sort returns no rows on a nullable/computed field (e.g. opportunities.budget). For a single page of highest list prices, prefer qobrix_list_properties / qobrix_search_properties with sort='-list_selling_price_amount'. Example uses: Top 2026 closed sales: resource='contracts', sort_by='final_selling_price_amount', search='contract_type == "cos" and contract_status == "agreed" and date_of_contract >= "2026-01-01" and date_of_contract < "2027-01-01"'. Largest active listings (full scan): resource='properties', sort_by='list_selling_price_amount', search='status == "available" and sale_rent == "for_sale"'. Most recently modified leads: resource='opportunities', sort_by='modified'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | Number of top records to return (default 10, max 50). | |
| desc | No | Sort descending (default true). | |
| fields | No | Optional projection. Always-resolved FK keys (property_id, agent, owner, assigned_to, etc.) are fetched regardless; this just limits other fields on the raw row. | |
| search | No | Hard-filter Qobrix search expression (server-side precision). Operators: == != <> < > <= >=, contains, starts with, ends with, in [...], not in, ranges in a..b, and/or/not. Functions: DISTANCE_FROM, IN_POLYGON, TRANSLATED, MIN/MAX, DAYS_AGO(n), MONTHS_AGO(n), DAYS_FROM_NOW(n). Shortcuts: NOW, TODAY, THIS_WEEK, LAST_MONTH, THIS_YEAR, CURRENT_USER. Strings double-quoted; booleans true/false; association paths e.g. SalespersonUsers.Contacts.country. Example: status == "available" and sale_rent == "for_sale" and list_selling_price_amount <= 500000. For the full grammar + field cheatsheets call qobrix_search_dsl_help. For enum values call qobrix_get_field_options; for all fields call qobrix_get_schema. | |
| include | No | Optional Qobrix associations to expand inline (passed through to the underlying list call). | |
| resolve | No | Extra FK field names to resolve to readable names, in addition to the always-resolve set (property_id, agent, owner, assigned_to, commission_to, commission_to_2, contact_name, salesperson, seller, project, developer_id, campaign_id). | |
| sort_by | Yes | Field to sort by (numeric or ISO date). Pages through matching rows and sorts in-process. Prefer list/search `sort='-field'` for a single page. Use this for full-dataset top-N, or when server-side sort returns no rows on a nullable/computed field (e.g. opportunities.budget). | |
| resource | Yes | Resource name (case-sensitive, lowercase plural as used by Qobrix API). Values: properties, opportunities, contacts, agents, tasks, property-viewings, projects, offers, contracts, calls, meetings, email-messages. |