is there an (easy) way to get the size of a text file when i import it via a dataport? i’d like to capture and log the file size so i can do some basic performance monitoring. i’m already grabbing the start/end times and the number of lines imported, but the kb size would be nice also…
CurrFile.LEN should do it, as described in the online help:
Use this function to return the length of an ASCII or binary file.
Length := File.LEN
Data type: integer
This tells you the length of the file in bytes.
Data type: file
Use this variable to refer to the file.
This function is often used with POS (File) and SEEK (File).
thanks, but now how do i associate an external file with a nav var Like MyFile of type file?
The CurrFile is already associated with your file in the dataport. So to get the lenght you would just do this:
FileLength := CurrFile.LEN;
thanks – that worked great! but… in a similar xmlport, the CurrFile is NOT already associated. i did this instead in my OnPostXMLPort:
MySize := 0;
MyFile.WRITEMODE := FALSE;
IF MyFile.OPEN(SrcFileName) THEN BEGIN
MySize := MyFile.LEN;
Is there a better way?