@MBRCOMPARE

Returns a member set of member names that match the comparison criteria. Member names are evaluated alphanumerically.

This function can be used on unique and duplicate-name outlines.

Syntax

@MBRCOMPARE (compOperator, tokenString, topMbrinHierarchy, cdfName)
ParameterDescription

compOperator

One of the following strings: < (less than), <= (less than or equal to), > (greater than), >= (greater than or equal to), == (equals), != (not equal to), or CDF (for a custom-defined function).

Note:

Using the == (equal to) comparison operator is the same as using the @EQUAL function. Using the != (not equal to) comparison operator is the same as using the @NOTEQUAL function.

tokenString

Token string value with which to compare to members in the outline, starting with the member specified in topMbrinHierarchy.

topMbrinHierarchy

A fully qualified name of a member in the outline on which to base the member search. The specified member and its aliases, and all of its descendants, are included in the search.

Note:

Although aliases of the specified member are included in the search, only outline member names (not aliases) are used when comparing member names.

To search the entire outline, provide an empty string ("") for this parameter. For example, @MBRCOMPARE("<=" , "100-10", "").

cdfName

Optional: This argument applies only if CDF is specified for compOperator.

Name of a custom-defined function.

The custom-defined function must take the tokenString and topMbrinHierarchy arguments and return a Boolean value. (When compiling @MBRCOMPARE, Essbase rejects custom-defined functions that do not meet these requirements.) If the function returns a value of TRUE, the member is added to the member set returned by @MBRCOMPARE.

Notes

The following example of a custom-defined function returns results similar to using the >= (greater than or equal to) comparison operator:

package com.hyperion.essbase.cdf.comparecdf;

class MyCDF {

public static boolean JavaNameCompare(String baseStr,
                                      String newStr)
{
try {
     System.out.println ("\n COMPARING MEMBER NAMES ..... \n ");
     // Compare the two strings.
     int result = newStr.compareToIgnoreCase(baseStr);
     if (result < 0)
        return false;
     else if (result == 0)
        return true;
     else
        return true;
}
catch (Exception e) {
   System.out.println ("Comparison function failed !!. Exception \n ");
   return false;
}
}

You must register the custom-defined function before you can use it in the @MBRCOMPARE function.

  To register the custom-defined function:

  1. Compile the custom-defined function into a JAR file. For example:

    CompareCDF.jar
  2. Copy the JAR file to the following directory:

    $ARBORPATH/java/udf
  3. To grant access to the JAR file, add the following statement to the end of the udf.policy file, which is located in the $ARBORPATH/java directory:

    grant codeBase "file:${essbase.java.home}/../java/udf/ CompareCDF.jar" {
    permission java.security.AllPermission;
    };
    
  4. To register the custom-defined function, use the following MaxL statement:

    CREATE OR REPLACE FUNCTION '@JAVACOMPARE'
    AS com.hyperion.essbase.cdf.comparecdf.MyCDF.JavaNameCompare(String,
    String)'
    SPEC '@ CUSTOMCOMPARE (Str1, Str2)'
    COMMENT 'Compares Strings returns boolean flag';
    

Example

The following examples are based on the following duplicate-name outline:

Product
   100
      100–10
         100–10–10
      100–20
      100–30
   200
      200–10
      200–20
      200–30
   300
      300–10
      300–20
   Diet
      100–10
         100–10–11
      200–10
      300–10
   Bottle
      200–10
      300–20
@MBRCOMPARE("<=", "100-10", "Product")

Returns the members 100, [100].[100-10], and [Diet].[100-10].

@MBRCOMPARE("==", "100-10", "Product")

Returns the members [Diet].[100-10] and [100].[100-10].

@MBRCOMPARE (“CDF”,"100-20", “100”, @JAVACOMPRE)

Uses the @JAVACOMPARE custom-defined function to return a member set.

See Also