Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: How to format a value inside a formula?

  1. #1
    Join Date
    Nov 2013

    Default How to format a value inside a formula?

    I have a simple formula to show either one filed or another in my report. One of them is String and the other numeric. I would like to format the numeric one:

    this is what I have now on a Label type


    and I would like a simple formating, kind of ...


    but cannot find any way to do it.

    PS. I guess I can print both fields on the same location and set visibility only for one of them as a workaround , but formatting a number in a formula should be easy!


  2. #2
    Join Date
    Mar 2003


    As long as you don't expect that formatted string to show up as proper number in Excel reports, your approach is fine. You just need to learn about the "MESSAGE(..)" formula function for the formatting part.

    =IF([param];[field1Str];MESSAGE("{0,number,0.000}"; [field2Num]))
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3
    Join Date
    Nov 2013


    Thanks Taqua, that will fullfill our needs .

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.