Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Adding a session variable to a FilterPanel

  1. #1

    Question Adding a session variable to a FilterPanel

    Hello everybody.

    I'm developing a Pentaho application, and I want to add a variable that could be accessed from the .xaction file where I'm defining the filter.

    My idea is accessing this variable using an "input" with "session" origin, so I can use it as a parameter in the SQL query that generates the filter data.

    I don't know how turn the variable accessible, and the classes that I should modify.

    I'm trying with org.pentaho.ui.portlet.FilterPanelPortlet class, but I can't do it work. This is what I'm doing:

    Code:
    PortletSession portletSession= request.getPortletSession();
          long groupid = ((Long)portletSession.getAttribute("LIFERAY_SHARED_VISITED_GROUP_ID_RECENT", PortletSession.APPLICATION_SCOPE)).longValue();
    userSession.setAttribute("groupid", groupid, PortletSession.APPLICATION_SCOPE);
    I have put this code inside the proccessAction method.

    Any suggestion? I find Pentaho source code quite complicated .

    Thanks!

  2. #2

    Default

    Hello again. This is the answer for my own question.

    I have modified doPortletView() method on org.pentaho.ui.FilterPanelPortlet class. In order to make visible an attribute for an .xaction FilterPanel definition I have followed these steps:

    Add this line:

    Code:
    userSession.setAttribute("attrName", attrValue, PortletSession.PORTLET_SCOPE);
    I have done this just before this line:

    Code:
    filterPanel.validate(userSession, null);
    Once it have been done, and the library is compiled and exported to the server, you can add a new input on the .xaction filter definition, whit source=session and name the one you choose for your attribute.

    Now you can use this attribute, for example, in an SQL query by doing {PREPARE:attrName}.

    It was simple, but I hope it helps some newbie like me.

    Greetings!

    Mario.

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.