Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Mondrian Input, Rename output columns

  1. #1

    Default Mondrian Input, Rename output columns

    Hi,

    Is it posible to rename the columns of the MDX query so insted of having dynamic column names like
    "[Date.YQM].[2010].[3].[Aug]"
    just have
    "Target"
    I need to do further procesing like adding KPI and ranges and top and bottom in the hole dataset and I need column names on following steps.
    I've tried using a job with two transformations that wite and read from a file, but the CDE that I will use to display data doesn't accept results from other transformation.

    Thanks for reading, any advice will be apreciated (yes even jokes, as this is getting fustraiting).

    Javier

  2. #2
    Join Date
    Sep 2009
    Posts
    810

    Default

    Hey there,

    couple of ideas, not sure they work. Haven't tried:
    - try formulating the query with calculated members (i.e. with MEMBER [Date.YQM].[target] as 'some stuff'... SELECT [Date.YQM].[target] ON ... FROM ...
    - if above fails, I'd probably look at the metadata and map the values to known field names at runtime. An example of something like that: http://type-exit.org/adventures-with...entaho-kettle/ Have a look at the "Flatten source fields" script.
    - try using metadata injection. Determine the names from the query in one transformation, feeding a "select values" step with proper rename logic in the transformation that actually calculates the KPIs

    Cheers
    Slawo

  3. #3

    Default

    Thanks Slawo,
    (I've seen people using that short name in your blog that I couldn't resist)
    1. I think using calculated members for ROWS is off, as the columns are YTD formulas and MDX throws an error.
    2. Im on it. Interesting post
    3. Wow, Didnt know about that..., I will look it up and post results.

  4. #4

    Default

    SOLVED
    As you sugested there are functions in the 'javascript step', that give you access to metadata from row and field.
    To get the values from column 2 and 3, you can use -example built from other post in the forum-:
    var rowOut = getOutputRowMeta();
    newRow = createRowCopy(rowOut.size());
    var Actual = rowMeta.getNumber(newRow, 1);
    var Mark = rowMeta.getNumber(newRow, 2);

    Now I have two columns that are called Actual and Mark no mater which months or years are selected in the dashboard
    and can be processed by other steps.
    Thanks slawomir!

  5. #5
    Join Date
    Sep 2009
    Posts
    810

Tags for this Thread

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.