Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Returning float value from UDJC

  1. #1

    Default Returning float value from UDJC

    Hi,

    I have to return a float value at the end of the process from User Defined Java class. In fields I have defined a variable with field value "Number". But its not working.

    Kindly help me.

    Regards,
    Subramanian S.

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Show how it fails in a small demo and we will show you how to succeed.
    So long, and thanks for all the fish.

  3. #3

    Default

    Hi,

    Please find the attachment. My system is generating postfix numbers. So I have to read them as string and convert them as number.

    I am getting the following error.

    Conv_Value Number: There was a data type error: the data type of java.lang.Float object [-1423.77] does not correspond to value meta [Number].

    Regards,
    Subramanian S.
    Attached Files Attached Files

  4. #4
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Instead of Float.valueOf() use Double.valueOf() - Kettle Number corresponds to Java Double.
    Better yet, don't use UDJC altogether.
    Use a Select Values step to convert your String to Number - the format string could be #.##-
    So long, and thanks for all the fish.

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.