Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5470 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

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 by Guest
changed title to reflect query better
Posted (edited)

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 by Guest
Posted (edited)

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 by Guest
Posted (edited)

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 by Guest
Posted

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 )

)

This topic is 5470 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.