July 20, 200718 yr Do you know how to parse out text from a field that has a huge amount of text. Each paragraph begins with a date, where I used a nested substitute calc to insert a "|" before each occurance of a date. Now the task is to create a routine that would copy each paragraph, and create a new record from those paragraphs into another file. Can anyone lend a clue please?
July 20, 200718 yr Author In another text field, using that substitute function I mentioned earlier, I was able to get that data to appear as a separate record (starting with a date, etc), and I also added a carriage return char so the data looks more normalized. The final result of this should show the following: (client_id) (comments) DOS100022 01/02/96 Bla Bla Bla This is some text DOS100022 02/15/96 This is some more notes for this client DOS100022 03/30/96 Some other notes -- DOS100043 06/05/96 Notes on this other client and so forth... All this needs to go from a comments file, into a comments details file. What am I missing? :-(
July 20, 200718 yr Are there carriage returns WITHIN each set of parse data? If not and there are carriage returns BETWEEN each paragraph, you wouldnt even have to worry about it starting with a date. You could just write a simple loop to parse it into separate records. Please report back.
July 20, 200718 yr Author I created the followiing calc field to show each "paragraph" as a single item: Middle( c_Comments_Add_Pipe, Position( c_Comments_Add_Pipe, "¶", 1 , (g_loop_counter-1) )+1, Position( c_Comments_Add_Pipe, "¶", 1 , (g_loop_counter) ) - Position( c_Comments_Add_Pipe, "¶", 1 , (g_loop_counter-1) )-1 ) Now the task is to copy each one of these into the details file, as new record of the "client ID" record (like a line item). I'm assuming a script that processes each paragraph as a new line item in details is what I need, but I'm not sure how to do it. Also, when the routine gets to the last paragraph within that record in the main file, the script needs to start the next client id record and strip out the text and add it as a new record of the new client id in the details file. Does this make any sense? :-!
July 20, 200718 yr Author "You could just write a simple loop to parse it into separate records" How do I write this? If this could be done, and all the data moves over correctly, that would be very righteous.
July 20, 200718 yr I'd suggest you post a simple file containing the ORIGINAL text (or a representative sample). As John said, the presence of carriage returns is significant, so make sure we get a correct picture there.
July 20, 200718 yr Author Here ya go. I hope this works And by the way, thank you kindly! Comments_Copy.zip Edited July 20, 200718 yr by Guest
July 20, 200718 yr That's a good start you've made there. See if this helps you to finish it. Comments_Folder.zip
July 21, 200718 yr Author I'm very thankful for the help. I managed to fit all the pieces together (similar, but different from the example) and the script processed all the records the first time (over 40,000) in details! :-)
Create an account or sign in to comment