Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Reduce service builds a new Fast Array containing only element 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. 

...

Code Block
// 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("MatchReduce", Handle, "pie", "MatchAnywhere")

// Result: "Apple Pie" :@FM: "Banana Cream Pie"

// All done
Variable = SRP_FastArray("Release", Handle:@FM:ReducedHandle1:@FM:ReducedHandle2)