Topic
1 reply Latest Post - ‏2014-02-07T07:03:37Z by Paul Mendelson
brunoro
brunoro
10 Posts
ACCEPTED ANSWER

Pinned topic How to merge Member with String

‏2014-02-06T12:12:59Z |

Hi guys,

Anyone ever done something like question below ?

Trying Concatenate:

'[(Cube)].[Period].[Period].[YearMonth]->:[PC].[@MEMBER].['||

substring (cast(current_date;varchar(10));1;4)||substring (cast(current_date;varchar(10));6;2)
||']'
 

I used substring to returns: 201402

Result MUN string:
 
[(Cube)].[Period].[Period].[YearMonth]->:[PC].[@MEMBER].[201402]
 
The result is a string, but not works, how to convert for MUN or member?

 

Thanks

 
  • Paul Mendelson
    Paul Mendelson
    61 Posts
    ACCEPTED ANSWER

    Re: How to merge Member with String

    ‏2014-02-07T07:03:37Z  in response to brunoro

    First thing to remember, never attempt to do any string concatenation, casting, or finding a current date with a cube, It will only end in tears. In your case you want the member to be constructed before the statement is processed.

    Instead, you can use macros to construct your mun. Macros will modify the select statement before it's sent to the database, so there won't be any issues with unsupported functions.  You could, for instance, do:

    #'[(Cube)].[Period].[Period].[YearMonth]->:[PC].[@MEMBER].[' + timestampMask($current_timestamp,'yyyymm')+']'#


    Look at this post for more details.