Gets the name of an ASCII or binary file.

Name := File.NAME

Parameters

File

Type: File

Use this variable to refer the file.

Property Value/Return Value

Type: Text or Code

This string contains the name of the file, including its path.

Remarks

You must use the OPEN Function (File) to open the file before you can use this function.

Example

The following example opens a text file that is named C:\TestFolder\TestFile.txt. The NAME Function (File) retrieves the name and path of the text file and stores it in the varName variable. The value in the variable is displayed in a message box. This example assumes that you have created a text file named C:\TestFolder\TestFile.txt. This example requires that you create the following variables in the C/AL Globals window.

Variable name DataType

TestFile

File

varName

Text

 Copy Code
TestFile.OPEN('C:\TestFolder\TestFile.txt');
varName := TestFile.NAME;
MESSAGE('The name of the file is: %1',varName);

See Also