Jump to content

Identifying text dates

This topic is 5684 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I need to split old comments (from another program) and turn them into records in our current comments. I am not even sure I need a custom function but I guess if I'm wrong, I can move it. :jester:

But I figure I might need CF because I have to mark the blocks to combine. A comment is preceeded by a text date of various forms. I can easily find valid dates and the new word-break rules really come in handy here but I'm still stuck. I get strange breaks in the string and I can't understand where my logic is wrong. A date should NOT be colored if it is followed by a period or carriage return (because it means it's part of the sentence itself). This works. In addition to the breaks indicated in purple (in the yellow field), there is one situation where I want to skip a date and that is when it is in the MIDDLE of a sentence (see last red 3/17/05). You will notice the omit variable in the CF includes an attempt at 'looking backward' but it fails. I'm not worried about no spaces before red dates because that will be my parse point. I will also have to figure how to look back at the last valid date (red) because if the current valid date has no year, FM will assume it's this year. I need it to use the prior 'valid' year instead (and also convert 99 properly etc) but I plan to do this portion when I parse it into records (I can hold the prior 'valid date' in a script variable) and I have contingency if no prior valid year. So I will be creating records from red date to red date - 1. I will probably use ~ instead of colorizing but I thought the color would be easier for you to see.

My problem stemmed from the fact that I need to look at an entire word to determine valid dates. But I needed to look PAST the word (for ending period or paragraph) or look forward (in case valid date is in middle of sentence) to know NOT to count it as a valid date. If I used Middle(), I couldn't see the whole word; if I use MiddleWords(), I can't see or grab what is past the word. Make sense? But mostly, I'm stuck on the purple breaks and have no idea why they are happening because they aren't at these date points!?!

This sample is a long ways from done but I can't parse something that doesn't even produce the correct results. I've indicated the breaks in the yellow field. What am I doing wrong here please ? :wink:

UPDATE: The results will go into two fields: CommentDate and Comment.



Edited by Guest
Link to comment
Share on other sites

I hope this does the trick for you. There seems to be many approaches to separating the comments but I decided to combine a recursive custom function that separates each sentence of the note field, determines if the first word is a date and places a return if necessary. Once the comments are separated, a looping script places them on separate records.


Link to comment
Share on other sites

This is an interesting approach. I'm sure others will be interested in the file as well so I should point out one change ... The first variable in the script should be changed to:

FindDates(Contacts::comment ; 0)

It was pointing to the note field (which I should have clearly indicated was only to illustrate the breaks). It parsed and colorized the breaks and I thought I was seeing CF-magic before my eyes - wondering how global variables might hang on and ... all kinds of wild thoughts! :giggle:

I realized the break in my logic on the word. The purple breaks were because I was looking for PatternCount(text ; word ; 1 ; 1 ) and there was word called 'call' at the BEGINNING of the string. So it was matching THAT instead. And I'll still need to shift the logic so it doesn't produce 'current year' dates but I'm moving again!!

Thanks again. These 'problems' teach me so much. :wink2:


Link to comment
Share on other sites

This topic is 5684 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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.