Creates a new list containing only those elements that match the given string.

Syntax

List = SRP_List("Reduce", Handle, StringToMatch, MatchAnywhereFlag)

Returns

Handle to a new list containing only those elements that match the given string.

Parameters

ParameterDescription
HandleHandle to an existing SRP List (REQUIRED)
StringToMatchThe string to find in the SRP List (REQUIRED)
OptionIf "MatchAnywhere", a match occurs if the string appears anywhere in the element. If "MatchAll", the whole element must match (OPTIONAL)

Remarks

The Reduce service searches for the all elements that match the given target and returns a new list with just those matches. The search is not case sensitive. A match occurs if the whole element has the same text unless the Option parameter is set to "MatchAnywhere", in which case the string can appear anywhere in an element. For example, if Option is "MatchAnywhere" and you are searching for "AND", there will be a successful match against "Branded". "MatchAnywhere" is the default if the Option parameter is omitted.

Examples

// Create the list
Handle = SRP_List("Create", "Apple Pie,Banana Cream Pie,Chocolate Cake,Pie", ",")

// This will return "Pie", since the search is looking for elements that entirely match "pie"
ReducedHandle1 = SRP_List("Reduce", Handle, "pie", "MatchAll")

// This will return "Apple Pie,Banana Cream Pie,Pie", since the search is looking for any element containing "pie" anywhere
ReducedHandle2 = SRP_List("Reduce", Handle, "pie", "MatchAnywhere")
 
// Play nice with memory
SRP_List("Release", Handle:@FM:ReducedHandle1:@FM:ReducedHandle2)
  • No labels