Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Using RE in integers

  1. #1
    Join Date
    Nov 2017
    Posts
    5

    Default Using RE in integers

    So i need to transform a field "cost" when it comes in dollars to euros, but i cant seem to find a way to use RE in integers. Is there anyway to do this or other solution for this problem ? thx

  2. #2
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    I'm failing to understand the acronym "RE" in this context... Could you explain more what you mean?

  3. #3
    Join Date
    Nov 2017
    Posts
    5

    Default

    Regular Expressions, but i realized just now that's not my problem =), the value never comes in integer because it has a char $ or €. basically what i need is to find the value fields from a xml that have the $ char in the end, and convert into in euros

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

    Default

    Actually, $42 is a string representation of a number combining a currency symbol and a monetary value.
    Usually, monetary values are stored by themselves, with a locale stored separately.
    Always try to find a primary datasource, don't rely on formatted output-only data.

    If you must retrieve dollar amounts from XML (combined strings), you can provide a format string like $0.00 (if locale is en-US) or '$'0.00 (if locale isn't en-US) to extract the monetary value.
    It's not a regular expression, just a pattern to control the number parser.
    You'll end up with a Number (42) implicitly declared as USD which you can convert to EUR by multiplying with an exchange rate in step Calculator.
    So long, and thanks for all the fish.

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.