Hitachi Vantara Pentaho Community Forums
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Using Sring Functions in Mondrian MDX

  1. #1
    Join Date
    Jan 2007
    Posts
    485

    Default Using Sring Functions in Mondrian MDX

    Hi all, I would appreciate some assistance.
    The SET I am trying to build uses string functions to read / build a set that refers to a Time Dimension. This looks more or less like:
    with Set [4thCutoff] as
    [SIZE=3][COLOR=#000000][FONT=Calibri]‘StrToMember("[Per

  2. #2
    Join Date
    Mar 2007
    Posts
    216

    Smile

    Hi,

    There seems to be a CAST mdx specific function :
    http://mondrian.pentaho.org/api/mond...astFunDef.html
    I think that you could replace CStr() with
    Code:
    CAST([Per�*odos Cosechas].CurrentMember.Parent.Parent.Name) AS STRING)
    Please give it a try and tell what you get.

    a+, =)
    -=Clément=-

  3. #3
    Join Date
    Jan 2007
    Posts
    485

    Default

    Hi Clement...

    I think you're missing a "(" in the CAST code.. hut I get the idea... I´ll give it a try...

  4. #4
    Join Date
    Jan 2007
    Posts
    485

    Default re your reply to: Using Sring Functions in Mondrian MDX

    Clement, enclosed is what I am trying to do...

    I honestly don´t know where to put the CAST(<> AS STRING)... maybe their is another way to arrive to the same place I want... Any ideas?

    The StrToSet () I need to get working is

    StrToSet( "{[Per
    Last edited by DMurray3; 04-03-2008 at 11:28 AM.

  5. #5
    Join Date
    Mar 2007
    Posts
    216

    Smile

    Hi,

    Quote Originally Posted by DMurray3 View Post
    Hi Clement...

    I think you're missing a "(" in the CAST code.. hut I get the idea... I´ll give it a try...
    In fact, there is an excess ")" in the CAST code, there is no need to put one before AS if I remember the function specs well.

    a+, =)-
    -=Clément=

  6. #6
    Join Date
    Mar 2007
    Posts
    216

    Default

    Hi,

    Code:
    StrToSet( "{[Per�*odos Cortes].[Per�*odos Corte Todos].[" +
    CAST([Per�*odos Cosechas].CurrentMember.Lag(-4).Parent.Parent.Name AS STRING) + "].[" +
    CAST([Per�*odos Cosechas].CurrentMember.Lag(-4).Parent.Name AS STRING) +
    "].[" +
    CAST([Per�*odos Cosechas].CurrentMember.Lag(-4).Name AS STRING) +
    "]}", 
    [Per�*odos Cortes]) gives nothing ?
    a+,=)
    -=Clement=-

  7. #7
    Join Date
    Jan 2007
    Posts
    485

    Default

    I tried the CAST(<expression> AS STRING)... and still am getting the Mondrian exception: 'string + string' ...

    My formula is:

    SET [TEST_cast] as 'StrToSet([B][COLOR=darkorange]"{[Per

  8. #8
    Join Date
    Jan 2007
    Posts
    485

    Default

    EEEEEUUURREEEEKAAAAAA!!!!! at last....

    After fidling around with the format applied in JHyde's blog.... the StrToSet that worked is..... (drum roll please......)

    SET [TEST_cast] as 'StrToSet("{[Per

  9. #9
    Join Date
    Jan 2007
    Posts
    485

    Default

    Partial success.... when using PCI V1.2.0 build 534 GA.... I will have to upgrade to 1.6...

    This is the stack trace:

    12:57:06,734 ERROR [RequestFilter] exeption
    org.apache.jasper.JasperException: Exception in JSP: /jsp/Pivot.jsp:403
    400:
    401: <div>
    402: <%-- if there was an overflow, show error message --%>
    403: <c:if test="${query01.result.overflowOccured}">
    404: <p>
    405: <strong style="color:red">Resultset overflow occured</strong>
    406: <p>

    Stacktrace:
    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspSer
    vletWrapper.java:504)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
    .java:375)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
    14)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at com.tonbeller.wcf.controller.RequestFilter$MyHandler.normalRequest(Re
    questFilter.java:139)
    at com.tonbeller.wcf.controller.RequestSynchronizer.handleRequest(Reques
    tSynchronizer.java:127)
    at com.tonbeller.wcf.controller.RequestFilter.doFilter(RequestFilter.jav
    a:263)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at org.pentaho.core.system.SystemStatusFilter.doFilter(SystemStatusFilte
    r.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
    lter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:178)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
    yAssociationValve.java:175)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
    torBase.java:432)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
    e.java:74)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
    a:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
    rocessConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
    int.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWor
    kerThread.java:112)
    at java.lang.Thread.run(Thread.java:534)
    12:57:06,734 ERROR [RequestFilter] cause
    javax.servlet.ServletException: javax.servlet.jsp.JspException: An error occurre
    d while evaluating custom action attribute "test" with value "${query01.result.o
    verflowOccured}": An error occurred while getting property "result" from an inst
    ance of class com.tonbeller.jpivot.tags.OlapModelProxy (mondrian.olap.MondrianEx
    ception: Mondrian Error:No function matches signature 'StrToSet(<String>, <Hiera
    rchy>)')
    at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageC
    ontextImpl.java:858)
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageCon
    textImpl.java:791)
    at org.apache.jsp.jsp.Pivot_jsp._jspService(Pivot_jsp.java:1024)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
    .java:332)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
    14)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at com.tonbeller.wcf.controller.RequestFilter$MyHandler.normalRequest(Re
    questFilter.java:139)
    at com.tonbeller.wcf.controller.RequestSynchronizer.handleRequest(Reques
    tSynchronizer.java:127)
    at com.tonbeller.wcf.controller.RequestFilter.doFilter(RequestFilter.jav
    a:263)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at org.pentaho.core.system.SystemStatusFilter.doFilter(SystemStatusFilte
    r.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
    lter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:178)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
    yAssociationValve.java:175)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
    torBase.java:432)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
    e.java:74)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
    a:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
    rocessConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
    int.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWor
    kerThread.java:112)
    at java.lang.Thread.run(Thread.java:534)

  10. #10
    Join Date
    Nov 1999
    Posts
    1,618

    Default

    If you ever get 'overflowOccured' (sic! note mis-spelling) from jpivot, look at the tomcat log, and you will see the error that was the real cause. Often it's something like a mistake in the schema.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.