Introduction
A query object gives you a reusable, read-only projection across Business Central tables. In this module, you design a customer sales query, consume its results in AL, and use it as a report data source.
Choose a query for set-based data
Use a query when you need to return selected columns from one or more tables, apply filters, or aggregate related rows as a set. A normal query is an AL data source. An API query exposes data through an API endpoint and uses API-specific properties.
The query result is read-only. If your application must update records, use record variables or another update-capable API for that work.
Module objectives
After completing this module, you can:
- Design query objects with columns, data items, links, joins, and predictable result semantics.
- Apply design-time and runtime filters and aggregate data for business requirements.
- Consume query results efficiently from AL code.
- Use a query as the data source for a Business Central report.