Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: referencing undefined (dynamic) fields due to query scripting

  1. #1
    Join Date
    Dec 2015
    Posts
    29

    Default referencing undefined (dynamic) fields due to query scripting

    I searched for a bit but couldn't find much, so I'll ask here....I have a report (PRD v6.0) but my query is NOT static, it has parameters so that the SQL is built in the "query scripting" tab. In doing it this way, I do not have my fields available in the drop-downs for certain things, one of them being for the "running sum" function. How do you perform a running sum when the fields are not being shown? Every sample report I see has the fields available to select due to having a static query. Any tips on how to handle dynamic queries/fields would be helpful!

    Thanks in advance for any help,
    Wes

  2. #2
    Join Date
    Dec 2015
    Posts
    29

    Default

    Well I've worked around this by using a BeanShell script...

    getValue(){
    resultSet = runtime.getData();
    totalRows = resultSet.getRowCount();
    int sumTotLoadCount = 0;
    for(rowIterator=0; rowIterator<totalRows;rowIterator++){
    sumTotLoadCount += runtime.getData().getValueAt(rowIterator,1);
    }
    return sumTotLoadCount;
    }

    But if anyone knows a simpler way, please share!

  3. #3
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Each field is exposed by both its name, and then again as "::column-by-index:n". Go to the preferences dialog and you can toggle the setting that exposes those fields in the UI of the report-designer.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

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.