Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Conditionally hiding report parameters
Conditionally hiding report parameters [message #641332] Thu, 25 November 2010 03:40 Go to next message
Josh Hall is currently offline Josh HallFriend
Messages: 31
Registered: October 2010
Member
Hi,

I am able to make report parameters hidden at design time by setting 'Hidden' to true in the Advanced tab of the Property Editor.

I'd like to be able to set this at run-time and cannot figure out how. 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:-
reportContext.getDesignHandle().findParameter('site_rptParam').hidden = true;


Any ideas?

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

Regards, Josh.
Re: Conditionally hiding report parameters [message #641350 is a reply to message #641332] Thu, 25 November 2010 06:57 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you are going to use the viewer this is not going to be possible.
One work around is to add a jsp page that does the checking you want and
then forward to one of two report (copy the orginal and disable the
parameters). The other way would be to write a report that forwards to
another report. Just add a text element with something like:

<script type="text/javascript">

function forward() {
var temp = new String(location.href);
//alert( temp );
var detailReport = "detail.rptdesign";
var TargetURL = temp.replace(/forwarddetail.rptdesign/, detailReport);

location.replace(TargetURL);

return false;
}
forward();
</script>

In the above you will need to set the detailReport based on your logic
to check for the user. Like:

var detailReport =
"<VALUE-OF>reportContext.getGlobalVariable("detailforuser"); </VALUE-OF>";

In your initialize (prbly better to put in beforeFactory) do your check
and set the value above:

var usr = ..getfromsession
//do usr to report correlation
reportContext.setGlobalVariable("myreport.rptdesign");

Jason


On 11/24/2010 10:40 PM, Josh wrote:
> Hi,
>
> I am able to make report parameters hidden at design time by setting
> 'Hidden' to true in the Advanced tab of the Property Editor.
>
> I'd like to be able to set this at run-time and cannot figure out how. 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:-
> reportContext.getDesignHandle().findParameter('site_rptParam ').hidden =
> true;
>
> Any ideas?
>
> If you're wondering why I want to do this, it's because for certain
> users I want to force a selection, and for others to make the selection
> programatically, and hide the parameter on the UI.
>
> Regards, Josh.
Re: Conditionally hiding report parameters [message #641561 is a reply to message #641350] Fri, 26 November 2010 05:59 Go to previous messageGo to next message
Josh Hall is currently offline Josh HallFriend
Messages: 31
Registered: October 2010
Member
Thanks Jason. I'll go for the separate report (as a copy of the original). I can easily direct my users to the version they need. It's a shame though, as it means maintaining two copies of what are essentially the same report Sad
Re: Conditionally hiding report parameters [message #641879 is a reply to message #641561] Mon, 29 November 2010 04:34 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Josh,

This would be a great enhancement request. Another thing you may want
to try is to use some logic in the parameter scripts to show certain
values preselected for given users.
http://www.eclipse.org/birt/phoenix/project/notable2.5.php#j ump_2

Jason

On 11/26/2010 12:59 AM, Josh wrote:
> Thanks Jason. I'll go for the separate report (as a copy of the
> original). I can easily direct my users to the version they need. It's a
> shame though, as it means maintaining two copies of what are essentially
> the same report :(
Re: Conditionally hiding report parameters [message #641885 is a reply to message #641879] Mon, 29 November 2010 05:23 Go to previous message
Josh Hall is currently offline Josh HallFriend
Messages: 31
Registered: October 2010
Member
Enhancement request created:-
https://bugs.eclipse.org/bugs/show_bug.cgi?id=331296

Regards, Josh.
Previous Topic:Problems with writing a plug-in
Next Topic:Problem with Stored Procedures - Birt
Goto Forum:
  


Current Time: Fri Apr 19 09:04:09 GMT 2024

Powered by FUDForum. Page generated in 0.02296 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top