Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Mondrian Error:Member expression 'StrToSet...must not be a set

  1. #1
    Join Date
    Jan 2007
    Posts
    485

    Default Mondrian Error:Member expression 'StrToSet...must not be a set

    Hi all,

    Attempting to build a "Set" (see http://forums.pentaho.org/showthread.php?t=60624)

    I have been trying to get the correct syntax for StrToSet() with a real case, but am always getting the following error:

    Mondrian Error:Member expression 'StrToSet("{[Perêodos Cosechas].[Perêodos Cosechas Todos].[2006].[2do Trim].[Jun]}", [Perêodos Cosechas])' must not be a set

    The above makes reference to the last "member" I am trying to calculate:

    with member [Measures].[DimName] as '[Perêodos Cosechas].CurrentMember.Dimension.Name'
    member [Measures].[HierName] as '[Perêodos Cosechas].CurrentMember.Hierarchy.Name'
    member [Measures].[LevName] as '[Perêodos Cosechas].CurrentMember.Level.Name'
    member [Measures].[AbueloVIG] as '[Perêodos Cosechas].CurrentMember.Parent.Parent.Name'
    member [Measures].[PadreVIG] as '[Perêodos Cosechas].CurrentMember.Parent.Name'
    member [Measures].[HijoVIG] as '[Perêodos Cosechas].CurrentMember.Name'
    member [Measures].[settostrlag4] as 'SetToStr({[Perêodos Cortes].[Perêodos Corte Todos].[2006].[2do Trim].[Jun].Lag((- 4.0))})'
    member [Measures].[set-to-str_lag4-cur-mem] as 'SetToStr({[Perêodos Cosechas].CurrentMember.Lag(- 4.0)})'
    member [Measures].[str-to-member_conlag-4] as 'StrToMember("[Perêodos Cortes].[Perêodos Corte Todos].[2006].[2do Trim].[Jun]").Lag(-4)'
    member [Measures].[str_to-set_lag4-cur-mem] as 'StrToSet("{[Perêodos Cosechas].[Perêodos Cosechas Todos].[2006].[2do Trim].[Jun]}",[Perêodos Cosechas])'
    select {[Perêodos Cosechas].[Perêodos Cosechas Todos].[2006].[2do Trim].[Jun]} ON COLUMNS,
    {[Measures].[DimName], [Measures].[HierName], [Measures].[LevName], [Measures].[AbueloVIG], [Measures].[PadreVIG], [Measures].[HijoVIG], [Measures].[settostrlag4], [Measures].[set-to-str_lag4-cur-mem],[Measures].[str-to-member_conlag-4], [Measures].[str-to-member_conlag-4]} ON ROWS
    from [CD4CuboCartera]

    As per the Mondrian 2.2 Tec Guide, the StrToSet(<String Expression>[, <Hierarchy>]) is supposed to be taking an "
    optional parameter"... which I understand that to be "..[, <Hierarchy>]..". I have tried replacing this with the following options with no success:
    - leaving it "blank" (because it is optional), the following error is shown Mondrian Error:Function 'StrToSet' must have at least 2 arguments
    - placing
    [Perêodos Cosechas] , I get the error "...must not be a set" as noted above;
    - placing Perêodos Cosechas , I get the error Unexpected character 'ê' Iwhich does not make any sense, given that the other Mondrian functionalities accept my latin chars..
    -I have tried using \" ...\" and even "\[Perêodos Cortes]\"... applying what is noted in in JHyde's blog http://forums.pentaho.org/showthread.php?t=50631, and the error appears as Unexpected character '\'

    I understand I am using the correct "Set" in these tests, as the results of the other "members" are as follows

    Perêodos Cosechas
    Measures Jun
    DimName Perêodos Cosechas
    HierName Perêodos Cosechas
    LevName Meses Cosecha
    AbueloVIG 2006
    PadreVIG 2do Trim
    HijoVIG Jun
    settostrlag4 {[Perêodos Cortes].[Perêodos Corte Todos].[2006].[4to Trim].[Oct]}
    set-to-str_lag4-cur-mem {[Perêodos Cosechas].[Perêodos Cosechas Todos].[2006].[4to Trim].[Oct]}
    str-to-member_conlag-4 9,307 (***)

    (***): I am still trying to find out why this result is being returned

    I am using PCI Pentaho. V1.2.0 build 534 GA and am trying the same on workbench-2.3.2.9247, and on the both the same error messages.

    Further more, I have reviewed all posted threads related to StrToSet... and see that the Tech Guide and other related documentation has not been corrected in regards to the correct syntax, ie. StrToSet(<string>, [Hierarchy] , <Hierarchy>)...

    I would very much appreciate anyone´s help. I urgently need to build the formula noted in thread 60624 noted above which has to do with explations contained herein.

    Regards, DMurray3
    Last edited by DMurray3; 03-26-2008 at 07:15 PM. Reason: To further add infor

  2. #2
    Join Date
    Mar 2007
    Posts
    216

    Smile

    Hi,

    Hi all,

    Attempting to build a "Set" (see http://forums.pentaho.org/showthread.php?t=60624)

    [...]
    Maybe the first argument is not seen as a String by MDX StrToSet Function. I would try
    Code:
    'StrToSet(CAST([Perêodos Cosechas].[Perêodos Cosechas Todos].[2006].[2do Trim].[Jun] AS STRING),[Perêodos Cosechas])'
    a+, =)
    -=Clément=-

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

    Default

    Several issues here.

    1. If you're doing WITH MEMBER you must supply an expression that evaluates to a member, not a set. You could try 'WITH MEMBER foo AS '<set expr>.Item(0)' '

    2. The hierarchy parameter isn't really optional. Mondrian needs it for its type-checking. If you're generating an N dimensional set, you must supply N parameters. E.g. crossjoin of Time and Product is 2-dimensional. Your example is one dimensional, so you must supply one hierarchy.

    3. Looks like you're running into an encoding issue. Don't know whether it's specific to StrToSet. Please log a bug. If you can reproduce using the FoodMart schema (say a WITH MEMBER clause to introduce a member with a non-7bit character in it, then a call to StrToSet) then it's more likely we'll fix it quickly.

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.