ExtractPortion ( textField ; prePortion ; postPortion )
Extract a portion of a text field
Average rating: 4.0 (38 votes) Log in to vote
US Home Systems, Inc.
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.
|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.
<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 ;
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.|
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.