JTSmith Posted February 17, 2012 Posted February 17, 2012 Ok, here is my problem, I'm hoping it's not impossible: I have a bunch of TXT files, which have HTML code in them. Each file has the same layout and stucture, but with the Customer Name & Address and Product Name & Desciption being different on each page. I want to strip all the other info from all the text, and end up with only 2 fields, Customer Name & Address and Product Name & Description left. Is that possible? Thanks guys, really appreciate the help!
comment Posted February 17, 2012 Posted February 17, 2012 It's probably possible, but we don't have enough details. Are you able to import the files so that each ends up in a record of its own?
JTSmith Posted February 19, 2012 Author Posted February 19, 2012 Comment, thank you for the reply, if anyone can help me, you can! Here is the file in HTM format, or you can view it in notepad. I greatly appreciate any and all help. example.htm
comment Posted February 19, 2012 Posted February 19, 2012 You haven't answered my question. I see two issues here: (1) how to import the file contents into a field; and (2) how to parse out the information you want. The second issue may be tedious, but other than that it should be easy - assuming the code is the same for all. However, the first issue is not as easy: your file's extension is .htm and Filemaker doesn't see it as a "text file" when importing a folder. Unless you are willing to insert each file individually, you will need an OS-level script or a plugin. Isn't there a way to get your data provider to switch to a more friendly format?
JTSmith Posted February 23, 2012 Author Posted February 23, 2012 Bear with me, I'm no expert.... I know they are HTM, and I can't do anything but convert them all to TXT files. I can import all the records, and end up with a bunch of 1 field records with all the text in the field. Once I get them in there, I was hoping there would be an easy way to extract the actual data I need. I tried Find/Replace, to basically delete all the common text and end up with just the data I need, but I only got as far as trying to delete the " and I'm not sure how to say I actually want to delete the ", and that I'm not trying to use it in a function format.....
comment Posted February 23, 2012 Posted February 23, 2012 I can import all the records, and end up with a bunch of 1 field records with all the text in the field. That's good. See if you can proceed with the attached. Receipts.zip
JTSmith Posted February 26, 2012 Author Posted February 26, 2012 When I tried an open it it shows empty and says Invalid. When I try to open the zip file that is... Am I doing something wrong on my end? Thank you.
LaRetta Posted February 26, 2012 Posted February 26, 2012 That is bizarre. It works fine for me just now. I'm Windows XP. I see nothing unusual in the zipped file nor the FM file.
JTSmith Posted February 26, 2012 Author Posted February 26, 2012 I'm using Windows 7, when I open it it's blank, and when I hit extract all it says "Windows cannot complete the extraction. The Compressed (zipped) Folder 'C:UsersJonathanDownloadsReceipts.zip' is invalid." Anyway you can send me just the FM file LaRetta?
LaRetta Posted February 26, 2012 Posted February 26, 2012 I am happy to try and the tester in me can't resist attempting to figure this out. So here is Receipts.zip which is my unzipped fp7 file zipped again (and the file opens fine). I have also attached ReceiptsORIG.zip which is my attaching Michael's original zip back (just to see if it is site related but I doubt it). Oh, but no, I can't send it as fp7 ... limits of this site. Receipts.zip ReceiptsORIG.zip
JTSmith Posted February 26, 2012 Author Posted February 26, 2012 The first one opened no problem! Thank you.
LaRetta Posted February 26, 2012 Posted February 26, 2012 As an aside, it seems that you may run into this again ... Windows 7 has a but bug unzipping in some situations (one being unzipping if zipped on a Mac). Here is link for you: http://fmforums.com/...__fromsearch__1 UPDATE: corrected typo ... Windows 7 might have a but as well but I meant to say bug, LOL.
JTSmith Posted February 26, 2012 Author Posted February 26, 2012 Thanks LaRetta, I had a hunch that might have been the issue... I will have to check into it.
JTSmith Posted February 26, 2012 Author Posted February 26, 2012 That's good. See if you can proceed with the attached. Ok, so if I copy and paste the text into the field one by one it works great, but when I import all the records as a folder, the fields state ***not found***. I'm assuming I'm importing the records wrong? I'm not sure...
comment Posted February 27, 2012 Posted February 27, 2012 It means that the string defined as prefix in the calculation was not found in the imported text. Perhaps it's only a difference in the way carriage returns are encoded.
JTSmith Posted February 27, 2012 Author Posted February 27, 2012 Ya because if I copy and paste the text from a file, and import the same file, it only works on the copied and pasted file. I'm going to see if I can remove all carriage returns from all the files using notepad++ and see if that resolves it...
JTSmith Posted February 27, 2012 Author Posted February 27, 2012 Got it! Thanks a ton, you saved me a great deal of time, I really apprecaite you help!
Recommended Posts
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