Function overview
Prototype
GetValue_After (
text; searchString; occurreence; include_1; Value )
Parameters
text
searchString
occurreence
include_1
Value
Description
Tags:
Value String After
Fabrice's original function After modified. By adding the GetValue to this function your can now extract only the row value after the string string. For example, if you enter 3 in the Value paramter it will return the value of the line 3 carriage returns from the searchString id include is 0 or the 2nd if include is 1.
Examples
Sample input
GetValue_After (YourTable::YourField ; "After" ; 1; 1 ;3 )
Sample output
by Fabrice Nordmann, BH&A
Function code
/*
GetValue_After ( text ; searchString ; occurrence ; include_1;Value )
*/
/*
Orginal Function
After ( text ; searchString ; occurrence ; include_1 )
by Fabrice Nordmann, BH&A
v.2.1 Sept 2007
v.2, Mar 2007
v.1, Jan 2007
v2 adds inclusion boolean parameter.
v2.1 corrects a bug with searchstring
MODIFIED TO
GetValue_After ( text ; searchString ; occurrence ; include_1;Value )
Only the value on the line of the paramer value
extracts (ONLY THE VALUE IN THE LINE OF THE VALUE PARAMETER) the end of a text, based on a search string and an occurrence number
occurrence can be positive (starting from the beginning of the text) or negative (starting from the end)
e.g.
Sample Input :
by Fabrice Nordmann, BH&A
v.2.1 Sept 2007
v.2, Mar 2007
v.1, Jan 2007
GetValue_After (YourTable::YourField ; "After" ; 1; 1 ;3 )
returns by Fabrice Nordmann, BH&A
see also Before, Between, and BetweenNext functions
*/
Let ([
$occurrence = Case ( not GetAsBoolean ( GetAsNumber ( occurrence )) ; 1 ; GetAsNumber ( occurrence ))
; $pos = Position ( text ; searchstring ; Case ( $occurrence < 0 ; Length ( text ) ; 1 ; $occurrence ) ; $occurrence ) + Length ( searchstring ) - 1
];
GetValue(Right( text ;
Length ( text ) -
$pos + GetAsBoolean ( include_1 ) * Length ( searchString )
); Value)
)
//GetValue & ;Value added to the above
//Robert Schaub 02/24/2009
//StarData
//http:/starrdata.com
// ===================================
/*
This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports
please visit http://www.fmfunctions.com/fid/207
Prototype: GetValue_After( text; searchString; occurreence; include_1; Value )
Function Author: Robert Schaub (http://www.fmfunctions.com/mid/60)
Last updated: 26 February 2009
Version: 1.2
*/
// ===================================
/*__LITBR____LITBR__GetValue_After ( text ; searchString ; occurrence ; include_1;Value )__LITBR____LITBR__*/__LITBR____LITBR____LITBR__/*__LITBR____LITBR__Orginal Function__LITBR__After ( text ; searchString ; occurrence ; include_1 )__LITBR____LITBR__by Fabrice Nordmann, BH&A__LITBR__v.2.1 Sept 2007__LITBR__v.2, Mar 2007__LITBR__v.1, Jan 2007__LITBR____LITBR__v2 adds inclusion boolean parameter.__LITBR__v2.1 corrects a bug with searchstring__LITBR____LITBR__MODIFIED TO__LITBR__GetValue_After ( text ; searchString ; occurrence ; include_1;Value )__LITBR____LITBR__Only the value on the line of the paramer value__LITBR____LITBR____LITBR__extracts (ONLY THE VALUE IN THE LINE OF THE VALUE PARAMETER) the end of a text, based on a search string and an occurrence number__LITBR__occurrence can be positive (starting from the beginning of the text) or negative (starting from the end)__LITBR____LITBR__e.g. __LITBR__Sample Input :__LITBR____LITBR__by Fabrice Nordmann, BH&A__LITBR__v.2.1 Sept 2007__LITBR__v.2, Mar 2007__LITBR__v.1, Jan 2007__LITBR____LITBR__GetValue_After (YourTable::YourField ; "After" ; 1; 1 ;3 )__LITBR____LITBR__returns by Fabrice Nordmann, BH&A__LITBR____LITBR____LITBR____LITBR__see also Before, Between, and BetweenNext functions__LITBR__*/__LITBR__Let ([__LITBR__ $occurrence = Case ( not GetAsBoolean ( GetAsNumber ( occurrence )) ; 1 ; GetAsNumber ( occurrence ))__LITBR__ ; $pos = Position ( text ; searchstring ; Case ( $occurrence < 0 ; Length ( text ) ; 1 ; $occurrence ) ; $occurrence ) + Length ( searchstring ) - 1__LITBR__];__LITBR____LITBR__GetValue(Right( text ;__LITBR__Length ( text ) -__LITBR__$pos + GetAsBoolean ( include_1 ) * Length ( searchString )__LITBR__); Value)__LITBR__)__LITBR____LITBR__//GetValue & ;Value added to the above __LITBR__//Robert Schaub 02/24/2009__LITBR__//StarData__LITBR__//http:/starrdata.com__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/207__LITBR____LITBR__ Prototype: GetValue_After( text; searchString; occurreence; include_1; Value )__LITBR__ Function Author: Robert Schaub (http://www.fmfunctions.com/mid/60)__LITBR__ Last updated: 26 February 2009__LITBR__ Version: 1.2__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.
Comments
26 February 2009
I actually use another function to accomplish this, but it's a matter of taste and habit.
BetweenNext ( _text; _searchString1; _occurrence1; _include1_boolean; _searchString2; _occurrence2; _include2_boolean )
with ¶ as _searchString2, and the number of values to extract as _occurrence2
Anyway, I'm not saying that your function is less useful, I just thought that because you were curious enough to explore After, you might like this one too.
http://www.fmfunctions.com/fname/betweennext
(Edited by Fabrice on 26/02/09 )
26 February 2009
I do use the Between , Before functions , but some times when picking through HTML those functions can pick up other unwanted characters or multiple substitutions need to be made.. By adding this to your original funtion, you can pick out one line item at a time.
Thanks for the original function.
26 February 2009