GETSTAMP Function (File)
Gets the exact time that a file was last written to.
[Ok :=] GETSTAMP(Name, Date [, Time])
Type: Code or Text
The name of the file, including the path. When you enter the path, consider these shortcuts:
You can omit the drive designation if the file is located on the current drive.
You can omit the full path if the file is located in the current directory.
You can enter only the subdirectory name if the file is located in a subdirectory of the current directory.
The date that the file was last written to.
(Optional) The time that the file was last written to.
Property Value/Return Value
If you omit this optional return value, then a run-time error occurs when the file cannot be found. When you include the return value, you must handle any errors. The return value can have these values:
true if the file exists and the function completes successfully; otherwise, false.
The following example gets the date and time that a file was written to and displays the data in a message box. The code example assumes that you have created the file 'C:\MyFolder\MyText.txt'. This example requires that you create the following variables and text constant in the C/AL Globals window.
|Text constant name||ConstValue|
|Text000||This document was last written to on %1 at %2.|
varFileName := 'C:\MyFolder\MyText.txt'; GETSTAMP(VarFileName, varDate, varTime); MESSAGE(Text000, varDate, varTime);