Barry685 Posted October 18, 2013 Posted October 18, 2013 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?
Barry685 Posted October 18, 2013 Author Posted October 18, 2013 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.
comment Posted October 18, 2013 Posted October 18, 2013 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
Barry685 Posted October 20, 2013 Author Posted October 20, 2013 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.
comment Posted October 20, 2013 Posted October 20, 2013 (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 October 20, 2013 by comment
Barry685 Posted October 20, 2013 Author Posted October 20, 2013 HI, Well I have no experience with mac . 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now