ExtractPortion ( textField ; prePortion ; postPortion )
Extract a portion of a text field
Average rating: 4.0 (38 votes) Log in to vote
Doug Elam US Home Systems, Inc. http://www.ushomesystems.com/ |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
The "middle" function is nice, but it requires you to know how many characters you want to extract. Sometimes, you don't know this, so you have to make complicated calculations to extract data. This is a simple function to extract data between point A and point B.
Comments
Daniel Wood, Digital Fusion Ltd Sep 22, 2010 |
||
Note that this extracts the contents between the first occurrences of prePortion & postPortion in the text. | ||
Mike Beargie, MainSpring, Inc. Sep 30, 2017 |
||
This function actually fails in instances where the first occurrence of the postPortion is before the first occurrence of the prePortion. EG: <div class='test'>some content</div> <div class='test2'>some content</div> If I run: ExtractPortion ( thatfield ; "<div class='test2'>" ; "</div>" ) it will fail due to the first "</div>" occurrence. You can correct this in changing: end = Position ( text ; postPortion ; 1 ; 1 ) - 1 ; to this: end = Position ( text ; postPortion ; start ; 1 ) - 1 ; |
||
Carl Riedel, Curator Contender Mar 17, 2020 |
||
Any way to make this a recursive function? Does anyone have a suggestion? I need to get multiple instances from a text field. | ||
Kevin B Aug 18, 2022 |
||
Can the 'prePortion' and 'postPortion' values include quotation marks, ie, "? | ||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.