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.

Importing a .txt File

Featured Replies

Hello,

I am trying to import roughly 40MB of text into FileMaker and separate the incoming data into 2 fields; an ID field and a field to put the text into. The source file is a .txt file.

A sample of the text file follows..;)

__F-997-341__

Text Text Text Text Text Text Text Text Text Text Text Text Text

Text Text Text Text Text Text Text Text Text Text Text Text

Text Text Text Text Text Text Text Text Text Text Text Text Text

__F-998-342__

Text Text Text Text Text Text Text Text Text Text Text Text Text

Text Text Text Text Text Text Text Text Text Text Text Text

__F-997-343__

And so on...

What I want to do is, when I import this text document, put the __F-Series__ sections of the text file into an ID field and then the Text part of the document into a text field. I would like 1 ID and 1 Text field per record. I've tried importing the whole text document into FileMaker and I think I have to work with it from there, but if anyone could give me a strong push into the right direction I would very much appreciate it. Thank you!

I don't think we have enough information here. Is it safe to assume that the ID always starts with 2 underscore characters and always ends with 2 underscore characters followed by a carriage return, and that the text never starts with 2 underscore characters and never ends with 2 underscore characters followed by a carriage return? If not, what is a safe assumption that would help identify which is which?

  • Author

Your assumption is correct; the ID starts and ends with 2 underscore characters, and the text never starts nor ends with 2 underscore characters.

You will need a rather complex script. I think it could be a little simpler if you started by importing the file as it is - which would create a record for each line in your text (I am assuming those are double carriage returns between each line).

After that, you would create another table, say Parent, and define a ID field (Text) in that table, and also add a similar ID field to the imported lines table. Define a relationship between the two tables, based on a match of the ID field. Allow creation of records on the Parent side.

Now you can run your script, that would (roughly);)

1. Find all empty line records and delete them;

2. Loop through all line records:

• If the line starts with "__", set field Parent::ID to Line::ID (this will create a new Parent record) , and also set a variable to Line::ID.

• Else set field Line::ID to the variable.

You should end up with a Parent record for each line that begins with a "__", and all the subsequent lines are related to it and can be shown in a portal.

  • Author

Thank you very much for the reply, comment.

Ahunter3 practically wrote the script you mentioned for me in another forum here:

http://filemakertoday.com/com/showthread.php?p=53889#post53889

I had some trouble though getting it to all come together, but after developing a relationship between two tables, like you suggested, rather than having it all on one seemed to solve the rest of my problems and it's working great. Thank you!

Ahunter3 practically wrote the script you mentioned for me in another forum here:

http://filemakertoday.com/com/showthread.php?p=53889#post53889

Actually, he wrote precisely the script I was trying to avoid, but if it works for you...

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.