US and Worldwide: +1 (866) 660-7555
Results 1 to 3 of 3

Thread: Aply JavaScript function to column values

  1. #1
    Join Date
    Aug 2012
    Posts
    25

    Default Aply JavaScript function to column values

    Hello i´m displaying a report with 2 columns. One of them represents the value of each category in bytes. But i need to apply the best scale (bytes, megabyte, gb..) for each one.

    I have a JavaScript function (bytesToSize) to do this but i don´t know how link the value to the column to the function.

    I tried to add to this text field in "Attributes/field" this expresion:

    "bytesToSize([val])"

    But it doesn´t works. Any body could help me? I tried a lot of combinations but it fails

    Thanks
    AJ

  2. #2
    Join Date
    Mar 2003
    Posts
    7,557

    Default

    Within the JavaScript function, you access other values with the data-row object:

    Code:
    var value = dataRow.get("val");
    var result = bytesToSize (value);
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3
    Join Date
    Aug 2012
    Posts
    25

    Default

    But where can i have to put this?. I dont´t know how use it

    Thanks

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
  •