Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

I am scripting an Import that I want to do without end user input.

Im on the windows platform. The file I need to import, is always in the "W" drive and in a folder that is stored in a field named "id_session".

The file is an xml file and is the only xml file in that folder. I do not know the name of the file but it's name also contains the value of the "id_Session" field.

 

For example if "id_Session" contains 20000.

The file would be in w:20000

The files name would be ???????20000????.xml

 

Can a filepathe expression be wriiten for this?

Posted

Maybe this will help.

 

The actual name of the xml file is: 2013-10-18_094839_23612_Pe_1.xml

 

The first part is the date of the export (I am always doing the import on the same day that the xml is exported).
The second part (094839) is some serial number that changes and I have no control over that.
The third part (23612) is the contents of the "Id_Session"  field.
The forth part (Pe_1)is always the same.

Posted

No, you cannot have wild cards in a file path. However, there are at least two ways you can work around the problem:

1. Use OS-level scripting or a plugin to rename the file before importing it;

2. Import all text files in the folder into another table; when you do that, the file name will be one of the "fields" you can import (along with the contents of the file and the path) - see:

http://www.filemaker.com/12help/html/import_export.17.16.html#1044791

Posted

Your import folder Idea doesn't work in this case (but it was a very good suggestion) because the Folder import only works with images or .txt files, and the file in this directory is xml.

 

Another developer gave me a solution that did work as follows:

 

I used a send event script step to rename the xml to something specific. Since I now know the name of the xml file, I can do the import automatically. This rename method only works when there is only one xml file in the folder which is the case.

Posted (edited)
the Folder import only works with images or .txt files, and the file in this directory is xml.

 

Have you tried this? I am curious, because xml files are text files and Filemaker should be smart enough to recognize that - at least on a Mac it does.

 

 

In any case, the Send Event method is the better choice (and is exactly what I meant by OS-level scripting; on a Mac you'd use Perform AppleScript to do the same).

 

 

 

---

BTW, I know practically nothing about Windows commands, but I am convinced that this is not true:

 

This rename method only works when there is only one xml file in the folder

 

Using the example from your second post, you should be able to use wildcards to specify the source filename as "2013-10-18_*_23612_Pe_1.xml" which is a string you can easily compute using the current date and the contents of the "Id_Session"  field.

Edited by comment
Posted

HI,

Well I have no experience with mac :hmm: .

But with the folder import even though the xml file is text it is looking for a .txt extension, so it does not work, and yes I tried it.

This topic is 4109 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.