Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Convert a column to a single cell?

  1. #1
    Join Date
    Mar 2007
    Posts
    28

    Default Convert a column to a single cell?

    Hi
    is it possible to convert a column to a single cell?

    The background is:
    I try top export as XML. I've got a root Element with some Attributes. Within I want a bunch auf Elements. I already have them. But they are in the rows auf a table (Each row contains one element).
    Now i want the whole content of the column wirtten in one single row in one cell to insert it in the root Element.

    Can anyone help me or do you have a better idea to solve this?

    THX
    Nils

  2. #2
    Join Date
    Dec 2005
    Posts
    531

    Default

    Hi,

    you can use the "Row denormaliser" step to convert the rows into columns and then use the "Add XML" step to create XML-tags from them.

    If you post some sample data we might be able to help you out even more.

    What version of Kettle are you running?

    Regards,
    Ingo

  3. #3
    Join Date
    Mar 2007
    Posts
    28

    Default

    Hi
    I'm using 3.0.0 Build 500

    Sorry, but I can't post real data. But this what I want to get:
    Code:
    <root atribute1="aValue">
        <anElement attribute2="anotherValue">
            <data1>value</data1>
            ...
            <datax>value</data>
        </anElement>
        ...
        <anElement attribute2="anotherValue">
            <data1>value</data1>
            ...
            <datax>value</data>
        </anElement>
    <root>
    And I get it now

    I used the "XML Add - creating multi level XML files.ktr" Example to get along.

    But now I've got another Problem:
    I use the "GroupBy" Step and "Concatenate strings separated by ,". Like shown in the example i took a little JS to delete the separators.
    But it takes ~200sek to delete em, while the rest of the transformation is done within a few seconds.
    At this point there schould have been about 400kb in the String. Is it a problem of the size of the data?

    So I still need a good solution to concatinate the Strings without the speparators

    regards
    Nils

  4. #4
    Join Date
    Mar 2007
    Posts
    28

    Default

    Hi
    no idea how to accelerate the step or are there alternatives?

    thx
    Nils

  5. #5
    Join Date
    Dec 2005
    Posts
    531

    Default

    Hi Nils,

    can you upgrade to 3.1? At the moment it is not yet GA, but the release is expected soon, I think. Quite some enhancements to the XML steps have been added, which might help you to avoid the bottle neck.

    For an immediate fix, did you try to start more then one copy of the JS step? (right mouseclick on JS Step--> number of copies to start)

    To be honest, without posting your transformation and some sample data (it doesn't have to be the original data !!!) it is very hard to help you out.

    Regards,
    Ingo

  6. #6
    Join Date
    Mar 2007
    Posts
    28

    Default

    Sorry, but I dont know how to generate Data that could help you, without presenting internals.

    But the task is still very simple:
    There is a XML Root element where a sequenz of elements should be insertet. I do this via placeholder and a replace. No problem, because there is just one single replace.
    But the bunch elements is generatet via "AddXML". One element per row. Via a fake collumn (always the same value) which groups the table you can agregate with "concatenate strings separated via ,". OK. No Problem yet.
    But getting rid of the ", " takes al lot of time.

    As a workaround I did some little changes to the GroupBy Step and deployed it as a new Plugin. Now its concattenating without ", "
    This accelerates from 250s to 10s

    But its not me who will use Kettle later. And the users will not be able to edit Plugins...

    For now the "problem" can be considered as solved. And I will have an eye on the new version.

    THX
    Nils

    PS: I took the source of the GroupBy from Version 3.04 and use it in 3.0. And here I get a little Problem:
    In GroupBy.Java in Line 436 and 439
    ValueDataUtil.sum
    The funktion sum can not be found in ValueDataUtil in package org.pentaho.di.core.row.ValueDataUtil
    Probably it's just because auf the version. But if some Uses 3.04 he could check this.

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.