Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Lock Import File Type in Scripted Import?

Featured Replies

FM7, In a scripted import, it possible to have the file type set to "Text" (instead of defaulting to "Any File") but still allow the user to pick a file? In experimenting with various settings I thought that I had figured out a way to do this, but now it doesn't seem to work.

The problem is that I have one file, which if import as "Any" will be determined to be CSV by filemaker instead of Tab-delimited text, which messes up the import.

No, the first time through the user must pick "file of type". Subsequent imports (in that session) will then use the last "type" selected

If it's possible to keep the name and path of the import file the same, save it in the script. Then, the "type" will also be saved (try it)

  • Author

Thanks. I wonder if another approach might work. It seems that FileMaker pays some attention to the file type. I wonder if naming my data files as ".dat" instead of ".txt" might keep filemaker from picking CSV instead of Tab-Delimited text when importing a text file?

FileMaker does pay attention to the extension of the imported file. That is used to determine which import filter FileMaker uses to convert the imported data.

FileMaker does pay attention to the extension of the imported file. That is used to determine which import filter FileMaker uses to convert the imported data.

FileMaker does pay attention to the extension of the imported file. That is used to determine which import filter FileMaker uses to convert the imported data.

  • Author

FileMaker does pay attention to the extension of the imported file. That is used to determine which import filter FileMaker uses to convert the imported data.

Does anyone know the complete list of mappings?

I'm specifically concerned with what TEXT file extensions will be interpreted either as "Tab Delimed" vs. "CSV"?

  • Author

FileMaker does pay attention to the extension of the imported file. That is used to determine which import filter FileMaker uses to convert the imported data.

Does anyone know the complete list of mappings?

I'm specifically concerned with what TEXT file extensions will be interpreted either as "Tab Delimed" vs. "CSV"?

  • Author

FileMaker does pay attention to the extension of the imported file. That is used to determine which import filter FileMaker uses to convert the imported data.

Does anyone know the complete list of mappings?

I'm specifically concerned with what TEXT file extensions will be interpreted either as "Tab Delimed" vs. "CSV"?

Interesting. It appears that if the setting is "All Available," and you import a .csv file, it will line up correctly. If you open the Import dialog afterwards you will see that it is set to "comma-separated." If you then choose a .tab file it will NOT import correctly at that setting; but it will if you change it back to "All available."

So it pays attention to the type of file for the import, if the setting is "All available," then it changes the setting to what that import was. Useful from a manual point of view, not so much from a scripting point of view. Because there is no option to knock it back to "All available" if it's currently something else without specifying a fixed file to import. The script step seems to also have that last setting by default.

I thought of a kludge to reset it with a script. Export (no dialog) a text file of the type you want, a very small file, 1 record, 1 field, with the file name and type set. Then import it. Delete the record.* Then run your other Import, with dialog. It should be set up correctly.

*If you choose the "first row is field names" option then it won't import a record, and it will change the import type. Sneaky :-]

Or, on a Mac, use AppleScript to put up the dialog to pick the file. Rename/move or copy it to a fixed location. Import with a fixed import step. Rename/move it back, or delete it. (I depends how big the file is whether moving it back and forth is worth while. Unless it's quite big, it's easier to duplicate it to the fixed location in one step, then delete the duplicate afterwards.)

Interesting. It appears that if the setting is "All Available," and you import a .csv file, it will line up correctly. If you open the Import dialog afterwards you will see that it is set to "comma-separated." If you then choose a .tab file it will NOT import correctly at that setting; but it will if you change it back to "All available."

So it pays attention to the type of file for the import, if the setting is "All available," then it changes the setting to what that import was. Useful from a manual point of view, not so much from a scripting point of view. Because there is no option to knock it back to "All available" if it's currently something else without specifying a fixed file to import. The script step seems to also have that last setting by default.

I thought of a kludge to reset it with a script. Export (no dialog) a text file of the type you want, a very small file, 1 record, 1 field, with the file name and type set. Then import it. Delete the record.* Then run your other Import, with dialog. It should be set up correctly.

*If you choose the "first row is field names" option then it won't import a record, and it will change the import type. Sneaky :P-]

Or, on a Mac, use AppleScript to put up the dialog to pick the file. Rename/move or copy it to a fixed location. Import with a fixed import step. Rename/move it back, or delete it. (I depends how big the file is whether moving it back and forth is worth while. Unless it's quite big, it's easier to duplicate it to the fixed location in one step, then delete the duplicate afterwards.)

Interesting. It appears that if the setting is "All Available," and you import a .csv file, it will line up correctly. If you open the Import dialog afterwards you will see that it is set to "comma-separated." If you then choose a .tab file it will NOT import correctly at that setting; but it will if you change it back to "All available."

So it pays attention to the type of file for the import, if the setting is "All available," then it changes the setting to what that import was. Useful from a manual point of view, not so much from a scripting point of view. Because there is no option to knock it back to "All available" if it's currently something else without specifying a fixed file to import. The script step seems to also have that last setting by default.

I thought of a kludge to reset it with a script. Export (no dialog) a text file of the type you want, a very small file, 1 record, 1 field, with the file name and type set. Then import it. Delete the record.* Then run your other Import, with dialog. It should be set up correctly.

*If you choose the "first row is field names" option then it won't import a record, and it will change the import type. Sneaky B)-]

Or, on a Mac, use AppleScript to put up the dialog to pick the file. Rename/move or copy it to a fixed location. Import with a fixed import step. Rename/move it back, or delete it. (I depends how big the file is whether moving it back and forth is worth while. Unless it's quite big, it's easier to duplicate it to the fixed location in one step, then delete the duplicate afterwards.)

  • Author

Great detective work!

Another question: do you think it is the presence of a comma in the first record that leads FM7 to pick CSV format when you choose "All available"? Or is it solely based on the file type?

  • Author

Great detective work!

Another question: do you think it is the presence of a comma in the first record that leads FM7 to pick CSV format when you choose "All available"? Or is it solely based on the file type?

  • Author

Great detective work!

Another question: do you think it is the presence of a comma in the first record that leads FM7 to pick CSV format when you choose "All available"? Or is it solely based on the file type?

Just a little experimenting on my system:

Imports "like" tab delimited:

abcdef,*tab*123*tab*aaaaaaaaaaaaaa

"abcdefg","123"*tab*aaaaaaaaaaaaaa

Imports "like" comma-delimited:

abcdef,*tab*123*tab*aaaaaaaaaaaaaa

"abcdefg","123",*tab*aaaaaaaaaaaaaa

Just a little experimenting on my system:

Imports "like" tab delimited:

abcdef,*tab*123*tab*aaaaaaaaaaaaaa

"abcdefg","123"*tab*aaaaaaaaaaaaaa

Imports "like" comma-delimited:

abcdef,*tab*123*tab*aaaaaaaaaaaaaa

"abcdefg","123",*tab*aaaaaaaaaaaaaa

Just a little experimenting on my system:

Imports "like" tab delimited:

abcdef,*tab*123*tab*aaaaaaaaaaaaaa

"abcdefg","123"*tab*aaaaaaaaaaaaaa

Imports "like" comma-delimited:

abcdef,*tab*123*tab*aaaaaaaaaaaaaa

"abcdefg","123",*tab*aaaaaaaaaaaaaa

  • Author

Thanks. Does it matter whether you name the files ".dat" or ".txt"?

  • Author

Thanks. Does it matter whether you name the files ".dat" or ".txt"?

  • Author

Thanks. Does it matter whether you name the files ".dat" or ".txt"?

changing from .txt to .dat seems to have no effect. What about giving the files a .tab extension and using fentons work around? It wont stop users from being able to import as "All Files (*.txt)" but it will at least default to the right file type - tab delimited.

changing from .txt to .dat seems to have no effect. What about giving the files a .tab extension and using fentons work around? It wont stop users from being able to import as "All Files (*.txt)" but it will at least default to the right file type - tab delimited.

changing from .txt to .dat seems to have no effect. What about giving the files a .tab extension and using fentons work around? It wont stop users from being able to import as "All Files (*.txt)" but it will at least default to the right file type - tab delimited.

  • 2 months later...
  • Author

I thought of a kludge to reset it with a script. Export (no dialog) a text file of the type you want, a very small file, 1 record, 1 field, with the file name and type set. Then import it. Delete the record.* Then run your other Import, with dialog. It should be set up correctly.

*If you choose the "first row is field names" option then it won't import a record, and it will change the import type. Sneaky :-]

I like this, but can't get it to work generically -- if I use "file:Dummy_Export.tab" for the export file, for some reason the same file reference doesn't work for the import file. I'm doing this on a file hosted on FM7 server on mac. Any thoughts about how to script this so it works for all users, rather than hard-coding a path name? I wonder if I could use the ~ symbol to get to the home directory?

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.