Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Do I wrong or it is a bug?

  1. #1
    Join Date
    Mar 2003
    Posts
    4,947

    Default Do I wrong or it is a bug?

    I'd like to create an itemband that display values depend on an itemfield,
    Therefore I create a subclass called TriggerFunction that
    will check condition before display values.
    below is the code.

    public class TriggerFunction extends AbstractFunction {

    public TriggerFunction() {
    }

    public void itemsAdvanced(final ReportEvent event) {
    ItemBand it = event.getReport().getItemBand();
    Object type = event.getDataRow().get("taxtype2");

    // and now apply the visibility ...
    if (type == null) {
    it.getElement("taxtype2").setVisible(false);
    it.getElement("paydate2").setVisible(false);
    it.getElement("pay2").setVisible(false);
    it.getElement("p2").setVisible(false);
    //System.out.println("NULL");
    } else {
    it.getElement("taxtype2").setVisible(true);
    it.getElement("paydate2").setVisible(true);
    it.getElement("pay2").setVisible(true);
    it.getElement("p2").setVisible(true);
    //System.out.println("NOT NULL");
    }

    }

    public Object getValue() {
    return null;
    }

    }

    I suppose to get the result like this
    -------
    line1
    -------
    line1
    line2
    ------
    line1

    but the result is
    ------
    line1
    ------
    line1
    ------
    line1

    when I change if-condition to (type != null) then I get the following
    -----
    line1
    line2
    -----
    line1
    -----
    line1
    line2

    when I add message to show condition I expect to get this
    NULL
    NOT NULL
    NULL

    but I get this
    NULL
    NOT NULL
    NULL
    NULL
    NOT NULL
    NULL
    NULL
    NOT NULL
    NULL

    It means that the code go into else statement but setVisible(true) doesn't work?

    Help me please

  2. #2
    Join Date
    Mar 2003
    Posts
    4,947

    Default

    The above code is OK except the code in createItemBand() function.

    I have to add setLayoutCacheable(false) in to itemband.

    ItemBand item = new ItemBand();
    item.setLayoutCacheable(false);

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.