{"title":"Query data type","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/query/query-data-type/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/query/query-data-type, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/query/query-data-type","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Enables you to retrieve data from multiple tables and combine the data in single dataset.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Static methods","slug":"static-methods","at":150,"chars":803},{"level":2,"title":"Instance methods","slug":"instance-methods","at":953,"chars":2675},{"level":2,"title":"Related information","slug":"related-information","at":3628,"chars":117}],"text":"> Version: _Available or changed with runtime version 1.0._\nEnables you to retrieve data from multiple tables and combine the data in single dataset.\n## Static methods\nThe following methods are available on the Query data type.\nMethod name|Description\nSaveAsCsv(Integer, Text [, Integer] [, Text])<query-saveascsv-integer-string-integer-string-method>|Saves the resulting data set of a query as a comma-separated values (CSV) file.\nSaveAsCsv(Integer, OutStream [, Integer] [, Text])<query-saveascsv-integer-outstream-integer-string-method>|Saves the resulting data set of a query as a comma separated values (CSV) file.\nSaveAsJson(Integer, OutStream)<query-saveasjson-method>|Saves the resulting data set of a query as an .json file.\nSaveAsXml(Integer, Text)<query-saveasxml-integer-string-method>|Saves the resulting data set of a query as an .xml file.\nquery-saveasxml-integer-outstream-method|Saves the resulting data set of a query as an .xml file.\n## Instance methods\nThe following methods are available on instances of the Query data type.\nMethod name|Description\nqueryinstance-close-method|Closes a query data set and returns the query instance to the initialized state. The following code shows the syntax of the CLOSE method. Query is a variable of the Query data type that specifies the query object.\nColumnCaption(Any)<queryinstance-columncaption-method>|Returns the current caption of a query column as a text string.\nColumnName(Any)<queryinstance-columnname-method>|Returns the name of a query column as a text string.\nColumnNo(Any)<queryinstance-columnno-method>|Returns the ID that is assigned to a query column in the query definition.\nGetFilter(Any)<queryinstance-getfilter-method>|Returns the filters that are set on the field of a specified column in the query. The following code shows the syntax of the GETFILTER method. Query is a variable of the Query data type that specifies the query object.\nqueryinstance-getfilters-method|Returns the filters that are applied to all columns in the query. The following code shows the syntax of the GETFILTERS method. Query is a variable of the Query data type that specifies the query object.\nqueryinstance-open-method|Runs a query object and generates a data set that can be read. The following code shows the syntax of the OPEN method. Query is a variable of the Query data type that specifies the query object.\nqueryinstance-read-method|Reads data from a row in the resulting data set of a query.\nSaveAsCsv(Text [, Integer] [, Text])<queryinstance-saveascsv-string-integer-string-method>|Saves the resulting data set of a query as comma separated values (CSV)\nSaveAsCsv(OutStream [, Integer] [, Text])<queryinstance-saveascsv-outstream-integer-string-method>|Saves the resulting data set of a query as comma separated values (CSV)\nSaveAsJson(OutStream)<queryinstance-saveasjson-method>|Saves the resulting data set of a query as Json\nSaveAsXml(Text)<queryinstance-saveasxml-string-method>|Saves the resulting data set of a query as XML\nqueryinstance-saveasxml-outstream-method|Saves the resulting data set of a query as XML\nqueryinstance-securityfiltering-method|Gets or sets how security filters are applied to the query.\nSetFilter(Any, Text [, Any,...])<queryinstance-setfilter-method>|Sets a filter on a column of a query to limit the records in the resulting data set of a query.\nSetRange(Any [, Any] [, Any])<queryinstance-setrange-method>|Sets a filter on a range of values on a column of a query data set.\nTopNumberOfRows([Integer])<queryinstance-topnumberofrows-method>|Specifies the maximum number of rows to include in the resulting data set of a query.\n## Related information\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}