Hitachi Vantara Pentaho Community Forums
Results 1 to 1 of 1

Thread: Fields, strings and assigning operations

  1. #1
    Join Date
    Feb 2011
    Posts
    840

    Default Fields, strings and assigning operations

    So, I have once again arrived on some major problem.

    Code:
    Example line:
    <detalhe elemento2="1207482934.84" elemento41="50" elemento42="07" elemento43="00" elemento44="1207482934.84" elemento45="020"/>
    I need this to be changed into this:
    Code:
    <detalhe codigoElemento="2" valorElemento="10014660.26"/>
    <detalhe codigoElemento="41" valorElemento="50"/>
    <detalhe codigoElemento="42" valorElemento="00"/>
    <detalhe codigoElemento="43" valorElemento="00"/>
    <detalhe codigoElemento="44" valorElemento="10014660.26"/>
    <detalhe codigoElemento="45" valorElemento="020"/>
    so the fields (and at the end, xml attributes) elementoXX="value" would be each one in a different element <detalhe>, being attributes themselves.

    First step I figured was using "Add constants" step to create the fields "codigoElemento" and "valorElemento". Then, "valorElemento" would be assisgned the value of "elementoXX", so far so good. But what gets me into trouble is how do I assign "XX" as the value of "codigoElemento".

    -=edit=- ok, not so easy the "assigning" part. since each "elementoXX=value" (comes from Excel file, elementoXX is the field's name) must be turned into it's own row. I thought about using "Row normaliser" so I could assign "typefield" as "XX" and the "newfield" as "valorElemento", but... I only get this error:
    Code:
    Number : There was a data type error: the data type of java.lang.String object [01] does not correspond to value meta [Number]
    -=edit2=- I got to make it work... but now, PDI tries to convert a number field to number, and fails to do so:
    Code:
    Unexpected conversion error while converting value [valorElemento Number] to a Number
    Attached file updated.
    Attached Files Attached Files
    Last edited by joao.ciocca; 03-03-2011 at 03:58 PM.

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.