Ocean West Posted February 5, 2005 Posted February 5, 2005 Part 1 Request Starting out with text in a field (global) === text text cat text text mouse text text text text text dog text text text text 123 inches text text bird text dolphin horse! text text text human text text DOG text === Then I have this table of keywords (This is a table w/ a record for each keyword.) === cat mouse dog bird dolphin DOG horse inches human What I would like learn how to build a custom recursive function that would firstly enable me to do this.. === text text [color:"red"]cat text text [color:"red"]mouse text text text text text [color:"red"]dog text text text text 123 [color:"red"]inches text text [color:"red"]bird text [color:"red"]dolphin [color:"red"]horse! text text text [color:"red"]human text text [color:"red"]DOG text === basically highlight text that are in the table this will allow this list to be abstract and extensible. Part 2 Request Taking this newly formatted field the applying a replace rules against it. In the keyword table there is another field with the replacement word. === keyword == replace == flag cat =======> feline mouse =====> Mice dog ======> Canine bird ======> null dolphin ====> FISH DOG ======> puppy horse! =====> glue. inches =====> " =====> X human =====> null Then in a separate field the following would be the result === text text [color:"blue"]feline text text [color:"blue"]Mice text text text text text [color:"blue"]Canine text text text text 123[color:"blue"]" text text text [color:"blue"]FISH [color:"blue"]glue. text text text text text [color:"blue"]puppy text === If there is the term "null" in the replace field the word is eliminated. Now if there is a flag in the last column it will also strip out any preceding space. this needs to be case sensitive and take into consideration the placement of a word cause it could be surrounded by different leading and trailing separators such as a space or paragraph symbol. Thanks I am trying to understand building a recursive function just haven't starred at it long enough to figure it out your guidance is appreciated.
Ugo DI LUCA Posted February 5, 2005 Posted February 5, 2005 Hi Stephen, As I was left alone in this ugly office with a computer with FM5 today, I tried it starting from the old way. I would say you may come with a better solution with 7 by involving Get(CalculationRepetitionNumber) in place of the hardcoded iterations in the demo file here. Of course, having it done by recursions through a custom function could be very powerful, but I couldn't try this. Highlighting is quite easy with the new Text Functions, so I skipped this step here. HTH ForStephen.zip
Ocean West Posted February 5, 2005 Author Posted February 5, 2005 Thanks Ugo, I have it setup right now thru a script where it will loop thru the records in the table and basically do a nested substitute. That seems to work well but because it has to loop thru records I am thinking it is slower. But then I had the thought if I could do say one loop at startup (since the library of words seldom changes) put all that in a return separated list. Then w/ recursion go thru that list and on pasting into the text field have it auto format the highlighted words. Then also the calculated text would also update. I just have to stare longer at recursion as it pertains to fields.
Ugo DI LUCA Posted February 6, 2005 Posted February 6, 2005 I may have too many time in my hands But this is about to change anyway. Far from perfect on the translator side, but the keywords are strating to compile better. Now I am dreaming or PatternCount isn't case sensitive on relationships or value lists ? KeywordsSubstitution.zip
Ender Posted February 6, 2005 Posted February 6, 2005 Now I am dreaming or PatternCount isn't case sensitive on relationships or value lists ? Here's a case sensitive PatternCount custom function: http://www.briandunning.com/filemaker-custom-functions/detail.php?fn_id=130
Ocean West Posted February 6, 2005 Author Posted February 6, 2005 Ok Here is the solution - curious if there is any way to make it even more "tighter" code? there are 6 Fields search list , replace list, flag list, hilite data, new data, and sample data. and 3 custom functions... LineValue (textlist ; lineNum) Substitute( MiddleValues ( (textList & Recursive.fp7.zip
Ocean West Posted February 6, 2005 Author Posted February 6, 2005 it is still a little buggy have to look at it further
Ugo DI LUCA Posted February 7, 2005 Posted February 7, 2005 May be, but this proves how powerful it can be compared to some workarounds we used to implement... Believe it or not, I still don't have Dev7 yet installed while I bought it. It's in the box. Well, next step is to put the CD then...:
comment Posted February 7, 2005 Posted February 7, 2005 Here's something I have played with. One custom function, one calc field. It is case sensitive. It doesn't do replacement, but that wouldn't be too hard to add using the same method. I haven't dealt with leading and trailing characters - I just did that in another context, and it's a major headache. hilite.fp7.zip
Recommended Posts
This topic is 7296 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