zach20 Posted June 21, 2007 Posted June 21, 2007 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!
comment Posted June 21, 2007 Posted June 21, 2007 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?
zach20 Posted June 21, 2007 Author Posted June 21, 2007 Your assumption is correct; the ID starts and ends with 2 underscore characters, and the text never starts nor ends with 2 underscore characters.
comment Posted June 22, 2007 Posted June 22, 2007 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.
zach20 Posted June 28, 2007 Author Posted June 28, 2007 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!
comment Posted June 28, 2007 Posted June 28, 2007 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...
Recommended Posts
This topic is 6358 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