Modifier

Partager via


Query.SaveAsCsv(Text [, Integer] [, Text]) Method

Version: Available or changed with runtime version 1.0.

Saves the resulting data set of a query as comma separated values (CSV)

Note

This method is supported only in Business Central on-premises.

Syntax

[Ok := ]  Query.SaveAsCsv(FileName: Text [, Format: Integer] [, FormatArgument: Text])

Parameters

Query
 Type: Query
An instance of the Query data type.

FileName
 Type: Text
The path and name of the file that you want to save the query to.

[Optional] Format
 Type: Integer
Specifies whether the columns of the resulting data set are at fixed positions in the CSV file or separated only by a delimiter.

[Optional] FormatArgument
 Type: Text
You set the FormatArgument parameter based on the setting of the Format parameter. If the Format parameter is set to 0, then the FormatArgument parameter specifies the starting position of each column in the data set. The value is a comma separated string of integers that includes an integer for every column. In a CSV file, each line is evenly divided into positions for holding characters. The first integer corresponds to the starting position of the first column, the second integer corresponds to the starting position of the second column, and so on.

Return Value

[Optional] Ok
 Type: Boolean
true if the SaveAsCsv succeeded, otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.

Query Data Type
Get Started with AL
Developing Extensions