StringFilters
There are 3 functions in the StringFilters class
RegExFilter(Set, RegExPattern, Expression, [ caseSensitive ] )This function returns a set of the members from the
Set parameter than match the
RegExPattern parameter when it is evaluated against the
Expression parameter. The
RegExPattern parameter can be any valid regular expression. The
Expression parameter provides the flexibility that the function can be run against member names, keys, captions or any expression that returns a string result.
Like(Set, LikePattern, Expression, [ caseSensitive ] )This function uses the same syntax as the T-SQL
LIKE operator, using the following wildcard characters in its patterns:
- % - matches 0 or more of any character
- _ - matches a single character
It returns a set of the members from the
Set parameter than match the
LikePattern parameter when it is evaluated against the
Expression parameter.
eg
// Returns all customers whose name contains a single initial followed by a full stop
Like([Customer].[Customer].Members
,"% _. %"
,[Customer].[Customer].CurrentMember.Name)IsLike(StringToMatch, RegExPattern, [ caseSensitive ] )Returns true if the first parameter matches the "Like" pattern that is provided as the second parameter. This variation of the function would most likely be used with functions like IIF() and FILTER().
NOTE: There appears to be an issue with running the string filters code under SP1 which manifests itself by throwing relatively frequent exceptions. Unfortunately, at the present time it is not advisable to use this code in a production environment.
UPDATE: (14 Nov 2006) It looks like the issue noted about may have been corrected in build 2154 (see
http://support.microsoft.com/kb/918753/) and as such should be included in SP2 when it is released.