Check file extension before import
I have an import script that first adds the import file as text into a field:
I would like to limit the import to only files with the file extension of my choice. At the moment, the would be files with the extension ".USR".
Therefore after the import script inserts the name of the file to be imported into gImportFile, I need a script line that will check if the file is has the .USR file extension, if so continue the import. If not, cancel the import.
Is there such a script line?
1) Set the validation option of gImportFile to ALWAYS validate, By Calculation:
t = Substitute ( Self ; "." ; ¶ ) ;
GetValue ( t ; ValueCount ( t ) ) = "usr"
2) The script will be something along:
Set Field [ YourTable::gImportFile ; "YourDesiredPath" ]
If [ Get ( LastError ) ]
Exit Script [ ]