Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: ValueInteger

  1. #1

    Default ValueInteger

    Hi,


    I'm writing a tranformation plugin and am having trouble with ValueInteger. I'm adding a new field to a row like this:



    r.addValue(new Value("inv_week", i));



    where i is an int. I believe this would create a new ValueInteger.



    When the next step runs it complains that inv_week is not set. The problem does not occur if I cast to long:



    r.addValue(new Value("inv_week", (long)i));



    Am I using Value correctly or is there a problem with using int?



    Thx, Jeff
    Pentaho BI Solutions for ERP
    www.erpbisolutions.com

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: ValueInteger

    Jeff,

    The constructor Value(String, int) is to create an empty value (null) with a certain data type.
    Like this:

    Value value1 = new Value("name", Value.VALUE_TYPE_STRING);
    Value value2 = new Value("id", Value.VALUE_TYPE_INTEGER);

    If you want to set an int, byte, long, ... value use:

    value1.setValue("Jeff");
    value2.setValue(5);

    Please note that you can change data types like this:

    value1.setValue(5) turning value1 into an Integer.
    This data type change is automatic, just like this.

    String name = value1.getString(); // "Jeff"
    String strId = value2.getString(); // "5"

    HTH,

    Matt

  3. #3
    Join Date
    Sep 2005
    Posts
    1,403

    Default RE: ValueInteger

    OK, I got it Matt. I'm just using the constructor wrong.
    Thx, Jeff

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.