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.

Text import nightmare

Featured Replies

I'm setting up a script to prompt the user for a text file and then import the data. That's all simple and good, except there's a problem: the text is return-delimited, but contains commas. For the sake of argument, assume it's a chat room log file.

So the text file contents will look like so:

AH: really good, but maybe later...

BP: Yes, I know what you mean.

etc...

What is set up to happen is for the import to take each line and create a new record (which has a single field for now) with all the text. This works fine, except FMP for some reason insists on trying to separate the text by commas. So far I've been unable to find any way around this behaviour.

Some caveats:

-this is on a windows system, so i can't use applescript

-it's for use in a commercial environment, so plugins are out of the question

-the files will always be named with a .txt extension

Any suggestions?

One way I've done these type files is to import the entire file into one global text field, then parse if from there using either set field or calculated results, but having said that, it is important to note that FM is notoriously slow at dealing with large files this way. If the file is small you can use this method, if large, then I'd rework it in a text editor prior to import.

Rod

  • Author

import the entire file into one global text field

This is actually feasible, but how do i set the script to do this? do i just make the import field into a global field?

if large, then I'd rework it in a text editor prior to import.

Not possible unfortunately, that would require the end-users to do it, and that ain't gonna happen...

Go to Import select import folder, insure the text file is in an independent or unique folder, select in file type import text file, and match the global to the file, this wil dump the entire txt file into the global field.

Rod

  • Author

The problem with that is that it once again places the onus on the end-user to do things correctly...

  • Author

Although, thinking about it some more, I wonder if it might be possible to use the webviewer to get the contents of the file...

Edited by Guest
typo

FileMaker defaults to .csv for text record imports. Is it possible for the original file to be saved with a .tab extension instead of .txt?

I believe that FileMaker defaults to the last File Format used for "That File", otherwise it will default to "All Available". Once you have use the Tab Format, it should default to it until changed to a different Format. You could use a script for this and then it will default to that format, but it is a little clunky if you don't also choose the file.

HTH

Lee

  • Author

the problem is that this also changes the file filter (at least on windows), to only show files with a .tab extension. Even worse, some of the text in question to be imported may contain erroneous tab characters, so this would cause the same problem. So far I'm having good results with the web viewer, i'll try to post more about this when i can

Importing as a .csv/.txt and then Concatenating the fields with a comma inserted probably wouldn't even work. You would have to have more fields than possible commas per line of text. The .csv import would also strip quotes from the text (at least it did on my machine).

You might be able to do this with an XML import but thats out of my league. Unfortunately, I think the best way might be to edit the text outside of filemaker before importing (VBScript may allow you to automate this).

Its a shame that Filemaker does not yet support text imports or exports.

Are you saying that if the file is a Tab file with a .csv extension on it, that it will be grayed if you select the Tab Format in the import window, and vice versa (.tab and comma format)?

  • Author

After playing with using the web viewer to import text some more, it does seem to work as I want it to, except that each line of text renders 3 line break characters after every line. I've no idea what causes it, and worse, because these are not "standard" filemaker line breaks, they can't be filtered out very easily. the only option i have at this point is to try and filter out all empty lines i suppose

  • Author

OK I'm talking nonsense... Actually the example file I was using was saved in unix formatted text and doesn't even display properly in notepad...

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.