September 13, 201015 yr Hi I'm trying to extract text from field using this calculation. Let ( [ start = Position ( text ; prefix ; 1 ; 1 ) + Length ( prefix ) ; end = Position ( text ; suffix ; start ; 1 ) ] ; Middle ( text ; start ; end - start ) ) The problem is that I don't have a unique suffix string. The prefix string is unique and I'd like Filemaker to extract the text between the prefix and the first occurrence of the suffix that comes after the prefix. Did that make any sense? /Johan
September 14, 201015 yr Author Only one. The suffix is always the same, but may occur several times through out the text. Its's the text between the unique prefix and the first time the suffix occurs (after the prefix) that I want to extract. Here is a simple example: Steve likes Apple, Bill hates Apple. Steve and Bill being the prefixes and Apple is the suffix. /Johan
September 14, 201015 yr Author If I don't use a unique suffix the calculation field remains blank. However if I change it to a unique suffix it extracts the text. Why is that?
September 14, 201015 yr I don't understand your question: the calculation returns " likes " when prefix = "Steve" and suffix = "Apple". If you change the prefix to "Bill" and leave suffix = Apple", the result will be " hates ".
September 14, 201015 yr Author I'm sorry, my mistake. I accidentally put a -1 instead of 1 Let ( [ start = Position ( text ; prefix ; 1 ; 1 ) + Length ( prefix ) ; end = Position ( text ; suffix ; start ; -1 ) ] ; Middle ( text ; start ; end - start ) ) It works fine now! :blush2:
Create an account or sign in to comment