December 1, 200916 yr Im wondering if anyone has any thoughts on the best way to stop a user importing the same file (via a script) more than once. The file is a .csv type. Edited December 2, 200916 yr by Guest changed title to reflect query better
December 1, 200916 yr Importing has several options - update existing records, update matching records, add new records. You are asking about what?
December 1, 200916 yr Assuming file names are unique, you could try something like: 1. Insert the file into a global container, as reference only; 2. Get the file's path from the container field and extract the file's name; 3. Test if it has been already imported - if not, create a new record in a table that records imported files and import the file (using a script $variable as the path). EDIT: Your post says "stop a user importing the same file", but the topic says "stop importing the same record twice". Two completely different things. Please try to formulate your questions more clearly. Edited December 1, 200916 yr by Guest
December 2, 200916 yr Author yes a little unclear Im sure. A user needs to import .cvs type files. I am trying to stop them importing the same file twice. Comment thanks - I will look at your solution Edited December 2, 200916 yr by Guest
December 2, 200916 yr Author Hi I ran Insert file to the container as a reference and the getastext = file:tony_payne_nov09_T1.csv filemac:/Macintosh HD/Users/john/Desktop/ WHP/Deakin_thermal_698/Deakin Thermal - remedial/Hobos/tony_payne_nov09_T1.csv Is there an easier way to get the path to this selected file than performing a calculation? Also I'd rather run the insert file command not as a reference so I just get the file name. Edited December 3, 200916 yr by Guest
December 2, 200916 yr If you embed the file in the container, you'll get only its name, not the path to it - and you need the path in order to import the file in step 3. It isn't very difficult to extract the file name from the path: it's whatever follows the last slash in the path: Let ( [ len = Length ( FilePath ) ; pos = Position ( FilePath ; "/" ; len ; -1 ) ] ; Right ( FilePath ; len - pos ) )
Create an account or sign in to comment