5 Replies Latest reply: Jul 23, 2007 9:48 AM by 3004 RSS

    Error while creating Custom Defined Functions in Essbase

    3004
      <p>Hi All,<br>I am trying to create CDF(Custom Defined Functions) in Essbase. Iwant to create a function which take list of child member andreturn the first child. For this, i have created a java file called"ChildAccess.java" which contains the following code:<br>public class ChildAccess<br>{<br>public static char GetFirstMember(char [] members)<br>{<br>return members[0];<br>}<br>}<br>I have compiled and made jar file called"ChildAccess.jar" and pasted it at"ARBORPATH/java/udf". Then i restarted the Essbase Serverand run the following MaxL command to register the function<br>create or replace function '@ChildAccess' as<br>'ChildAccess.GetFirstMember'<br>spec '@ChildAccess(memberRange)'<br>comment 'adds list of input members'.<br>Till here i am not getting any error but when i am using thisfunction in my calc script as given below<br><br>FIX(@ChildAccess(@CHILDREN("Abc")))<br><br>it gives the following error<br>"Error:1200414 Error parsing formula for [FIX STATEMENT]<br>(line 2)"argument[1] may not have size[6] in function[@CHILDREN]"<br>NOTE: The SIZE[6] is giving the no. of child in member"ABC".<br><br>Thanks in Advance<br>Arpit</p>
        • 1. Error while creating Custom Defined Functions in Essbase
          3004
          You can download this CDF from this site.<BR><BR><a target=_blank class=ftalternatingbarlinklarge href="http://dev.hyperion.com/download/code_library/child_access.cfm">http://dev.hyperion.com/downlo...brary/child_access.cfm</a>
          • 2. Error while creating Custom Defined Functions in Essbase
            3004
            If you want to use the CDF in a FIX statement you need to make sure that it returns a member name rather than a number:<BR><i><BR>public class ChildAccess<BR>{<BR>    public static String GetFirstMember(String[] members)<BR>    {<BR>        return members[0];<BR>    }<BR>}<BR></i><BR>I prefer to define the function against a specific application rather than globally because you only need to restart the application in order to pick-up any modifications to the .jar file. So the MaxL function definition would be:<BR><i><BR>    create or replace function appname.'@_GETFIRSTMEMBER' as<BR>        'ChildAccess.GetFirstMember(String[])';<BR></i><BR>and in the calculation script the FIX statement would become:<BR><i><BR>    fix ( @member( @_GetFirstMember( @name( @children( "Abc" ) ) ) ) )<BR></i><BR>This looks a little messy so you can use a macro to simplify it:<BR><i><BR>    create or replace macro appname.'@GETFIRSTMEMBER'(single) <BR>        as '@member( @_GETFIRSTMEMBER( @name( @@1 ) ) )' <BR>        SPEC "@GETFIRSTMEMBER(memberRange)";<BR></i><BR>and then the FIX statement could be written:<BR><i><BR>    fix( @getfirstmember( @children( "PRODUCT" ) ) )<BR></i>
            • 3. Error while creating Custom Defined Functions in Essbase
              3004
              <p>Hi,<br>Thanks for your quick reponse.I have applied your method but i amstill getting the same error.<br>Please help.<br>Arpit</p>
              • 4. Error while creating Custom Defined Functions in Essbase
                3004
                If you are still getting the same error as initially reported:<BR><i><BR>Error: 1200414 Error parsing formula for [FIX STATEMENT] (line 0): argument [1] may not have size [6] in function [@CHILDREN]<BR></i><BR>then I am assuming that you are still registering your CDF as @CHILDACCESS.<BR><BR>The problem here I believe is that that your CDF is actually being interpreted as the @CHILDREN function. You can test this by just changing the function name in the calculation script to anything prefixed with @CHILD, e.g. @CHILDISHNESS. Even though this function has not been registered you will still get the same message (tested with Essbase 9.2.0).<BR><BR>I did not realise this until I started looking at your problem, but the error message makes complete sense when you do.<BR><BR>If you then register your original CDF with another name, e.g. @GETFIRSTMEMBER, then you would still get an error:<BR><i><BR>Error: 1200315 Error parsing formula for [FIX STATEMENT] (line 1): invalid object type<BR></i><BR>because your original function returns a truncated number rather than a member name.
                • 5. Error while creating Custom Defined Functions in Essbase
                  3004
                  Hi All,I am also trying same as mentioned above. I published the java as @vik function name.And trying following Member formula:-IF(@Member(@Vik(FY02))== FY02)abc = 1;ENDIFBut it gives me following error:-Error(1200472) - Error compiling formula for [abc] (line 1): too many parameters in function [@MEMBER]I also tried <IF(@ISMBR(@Vik(FY02))== FY02)> and other as formulas.. but nothing is working.Kindly suggest something.Thanks