Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331296

Summary: Add the abilility to hide report parameters at run-time
Product: z_Archived Reporter: Josh Hall <joshdanhall>
Component: BIRTAssignee: Birt-ReportEngine-inbox <Birt-ReportEngine-inbox>
Status: REOPENED --- QA Contact: Xiaoying Gu <bluesoldier>
Severity: enhancement    
Priority: P3 CC: bluesoldier, brandon.c.autrey
Version: 2.6.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Josh Hall CLA 2010-11-29 00:21:43 EST
Build Identifier: 20100917-0705

Enhancement request, following discussion at the following forum:-
http://www.eclipse.org/forums/index.php?t=rview&goto=641879#msg_641879If

I'd like to be able to conditionally hide report parameters at run-time. I have tried adding the following to the initialize method of the Report Design, however I think this is too late as it doesn't affect the UI at all (when viewed in the web viewer app):-
reportContext.getDesignHandle().findParameter('site_rptParam').hidden = true;

If you're wondering why I want to do this, it's because for certain users I want to force them to make a selection, and for other users I to make the selection programatically, and hide the parameter on the UI.


Reproducible: Always

Steps to Reproduce:
n/a (see above)
Comment 1 Xiaoying Gu CLA 2010-11-29 03:22:43 EST
Have you tried to add reportContext.getDesignHandle().findParameter('site_rptParam').hidden = true; in the parameter's getDefaultValueList event?

It works in my environment.
Comment 2 Xiaoying Gu CLA 2010-11-29 22:32:58 EST
Set as worksforme based on comment #1.

Please feel free to reopen if there is any issues.
Comment 3 Josh Hall CLA 2010-12-01 18:28:24 EST
That did work. To me though, it feels like a work-around. It's not obvious to the developer that to set parameter attributes, one should add code to 'getDefaultValueList'. Re-opened this in the hope that an 'initialize' event may be added.

It would be great if this was added to a Java event handler as well as the JavaScript one.
Comment 4 brandon autrey CLA 2016-08-10 15:51:35 EDT
I tried to unhide a parameter based on the selection of a boolean checkbox.  This is so to only show the user what needs to be filled in.  When the boolean is selected true, then you need to enter in the start and end date. 

This is the code in the script for the boolean parameter of script type getDefaultValueList:

if (params["Enable_Completed_Date"].value)
{
    reportContext.getDesignHandle().findParameter("StartDate").hidden = false;
} else {
    null;
}

This doesn't work, but I would expect this to work as both of the params and reporContext variables work independently.  I think there needs to be a new script type for event handling, like when this boolean value is changed, run this script.  I suspect currently that it runs it all once when the parameter page first opens up.