Creates a new fast array containing only those elements that match the given string.
Syntax
SRP_FastArray("Reduce", Handle, StringToMatch, Option)
Parameters
| Parameter | Description |
|---|---|
| Handle | Handle to an existing SRP Fast Array (REQUIRED) |
| StringToMatch | The string containing the text you are trying to find. |
| Option | If "MatchAnywhere", the match can occur anywhere in an element. If "MatchAll", only exact matches count. |
Remarks
The Reduce service builds a new Fast Array containing only elements that match the given string. The match is not case sensitive, but if the Option parameter is "MatchAll" (which is the default), then a match succeeds only when the string matches the entire element. If the Option parameter is set to "MatchAnywhere", then the first element contain the given string anywhere within itself is a match. For example, "Branded" is considered a match for "AND" because "and" appears within the element.
Examples
// Create a fast array
Handle = SRP_FastArray("Create", "Apple Pie":@FM:"Banana Cream Pie":@FM:"Chocolate Cake")
// Return only elements exactly matching "chocolate cake"
ReducedHandle1 = SRP_FastArray("Reduce", Handle, "chocolate cake", "MatchAll")
// Result: "Chocolate Cake"
// Find all elements containing "pie"
ReducedHandle2 = SRP_FastArray("Reduce", Handle, "pie", "MatchAnywhere")
// Result: "Apple Pie" :@FM: "Banana Cream Pie"
// All done
SRP_FastArray("Release", Handle:@FM:ReducedHandle1:@FM:ReducedHandle2)