PDA

View Full Version : How to handle parameters in CalculatedMember



luzirene_gomeza
01-16-2006, 09:59 AM
Hi Julian Hyde.
Can you give me an example of like managing parameters received by the user and these can be part of a calculated member or statement MDX (<CalculatedMember name="" dimension="Measures", ...) to execute an operation with those data.
I check the example the UserDefinedFunction (PlusOneUdf) but it throws me the following error:
Mondrian Error:No function matches signature 'PlusOne(<Member>)'
In the statement MDX
WITH MEMBER [Measures].[Unit Sales Plus One]
AS 'PlusOne([Measures].[Unit Sales])'
SELECT
{[Measures].[Unit Sales]} ON COLUMNS,
{[Gender].MEMBERS} ON ROWS
FROM [Sales]
En the file xml I have:
<UserDefinedFunction name="PlusOne" class="com.acme.PlusOneUdf"/>
<CalculatedMember name="PlusOne" dimension="Measures" formula="PlusOne([Measures].[unit_sales])">
<CalculatedMemberProperty name="FORMAT_STRING" value="$#,###.##"/>
</CalculatedMember>
In the file .java (PlusOneUdf.java) implements UserDefinedFunction and import the follow:
import mondrian.olap.*;
import mondrian.olap.type.*;
import mondrian.spi.UserDefinedFunction;
Thank you, very much.

luzirene_gomeza
01-17-2006, 03:43 AM
Hi. I change the position the the function UserDefinedFunction and CalculatedMember until last the code the file xml (before </Schema>) and throw me the follow error:
javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: Mondrian Error:Failed to load user-defined function 'PlusOne': class 'com.acme.PlusOneUdf' not found
mondrian.olap.MondrianException: Mondrian Error:Failed to load user-defined function 'PlusOne': class 'com.acme.PlusOneUdf' not found
Please, help me. Thank yoy

sgwood
01-17-2006, 04:17 AM
It looks like the class is not on the classpath.
Sherman

luzirene_gomeza
01-18-2006, 02:51 AM
I change the path of the class and it's run correctly.
Thank you very much.