January 27, 200917 yr Hello All I have a text field called "bigtextfield" which contains many lines of "tagged text" items of which the following are just three: <>Charlie Anylength <>[email protected] <>sometext I have a calculation field of the following format, which successfully does what I want, which is to "parse" the contents of the above field splitting the text of each <> into a separate field: Let ( [ start = Position ( bigtextfield ; "<>" ; 1 ; 1 ) + Length ( "<>" ) ; end = Position ( bigtextfield ; "¶" ; start ; 1 ) ] ; Middle ( bigtextfield ; start ; end - start ) ) However, it fails for the final line of "bigtextfield" because that one doesn't end with a return ("¶")!! Can someone give me a version which works even for a line which is followed by nothing! Many Thanks.
January 27, 200917 yr Try: Let ( [ start = Position ( bigtextfield ; "<>" ; 1 ; 1 ) + Length ( "<>" ) ; end = Position ( bigtextfield & ¶ ; ¶ ; start ; 1 ) ] ; Middle ( bigtextfield ; start ; end - start ) )
January 27, 200917 yr Author Thank you, comment. That seems to work nicely! The only time it doesn't work is if I have a typo in the name of the <> being extracted, in which case instead of being left blank, it seems to pick up the value of another <>!! Can you suggest a way to catch this? Thanks again.
January 27, 200917 yr Let ( [ pos = Position ( bigtextfield ; "<>" ; 1 ; 1 ) ; start = pos + Length ( "<>" ) ; end = Position ( bigtextfield & ¶ ; ¶ ; start ; 1 ) ] ; Case ( pos ; Middle ( bigtextfield ; start ; end - start ) ) )
January 27, 200917 yr Author Thanks, once again! It seemed to need one more ) at the end, but once that was put in it seems like it works perfectly. Your help is much appreciated. PHILIP
January 28, 200917 yr Author You're right... The final ")" was of course in your code, but I failed to include it when copying-and-pasting it. My apologies!
Create an account or sign in to comment