Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How to dynamically control parameter visibility(How to dynamically control parameter visibility)
How to dynamically control parameter visibility [message #1162783] Wed, 30 October 2013 16:15 Go to next message
Michael Murphy is currently offline Michael MurphyFriend
Messages: 3
Registered: October 2013
Junior Member
Hi, I am pretty new to Birt and am still finding my way around.

I have a report where I want to ask one of two questions, depending on the value passed to the report from an application. I therefore have 3 parameters.
param1, the param I receive a value for, A or B. If the value of param1 is 'A', I want param2 to be displayed and I want param3 to be hidden. If the value of param1 is 'B', I want param2 to be hidden and I want param3 to be displayed.

Any help would be much appreciated.
Re: How to dynamically control parameter visibility [message #1163762 is a reply to message #1162783] Thu, 31 October 2013 07:42 Go to previous messageGo to next message
Marina Orth is currently offline Marina OrthFriend
Messages: 51
Registered: September 2012
Member
Hello,

you could use a dynamic text and following expression:

var result="";
if (params["param_1"].value=="A") {
result = params["param_2"].value
}
else if (params["param_1"].value=="B") {
result = params["param_2"].value
}
result;

or little bit shorter:
(params["param_1"].value=="A")? params["param_2"].value : params["param_3"].value

In the second case param_3 is shown, even if param_1 is "C". In the first case would "" be shown, if param_1 is "C".

Or you take param_2 and param_3 in the same grid for example per drag and drop and use properties->visibility->hide element for specific outputs. For param_2 you write:
params["param_1"].value=="B" and for param_3 is hidden for params["param_1"].value=="A"

Greetings
Re: How to dynamically control parameter visibility [message #1164228 is a reply to message #1163762] Thu, 31 October 2013 14:22 Go to previous messageGo to next message
Michael Murphy is currently offline Michael MurphyFriend
Messages: 3
Registered: October 2013
Junior Member
Marina,

Thank you for that but I think I have not explained my case properly.

param1 can have a value A or B

If the value is A, I want param2Color to be displayed and param3Size to be hidden.
If the value is B, I want param3Size to be displayed and param2Color to be hidden.

I then want to modify the dataset select statement in the 'beforeOpen' script with the following

if (params["param2Color"] == "")
{
;
}
else
{
this.queryText = this.queryText + " and `color` = " + params["param2Color"] ;
}


if (params["param3Size"] == "")
{
;
}
else
{
this.queryText = this.queryText + " and `size` = " + params["param3Size"] ;
}


... and I want just one of the two restrictions to apply, depending on the value of param1. It is the 'hidden' attribute of the param2Color and param3Size that I want to control.


Thanks.
Re: How to dynamically control parameter visibility [message #1170163 is a reply to message #1164228] Mon, 04 November 2013 12:54 Go to previous messageGo to next message
Marina Orth is currently offline Marina OrthFriend
Messages: 51
Registered: September 2012
Member
Hi,

i'm not quite sure, if i understood your problem, but why aren't you using this in the beforeOpen Script:

if (params["param1"] == "A")
{
this.queryText = this.queryText + " and `color` = " + params["param2Color"] ;
}
else if (params["param1"] == "B")
{
this.queryText = this.queryText + " and `size` = " + params["param3Size"] ;
}

And additionally you can set visibility for param2Color and param3Size like I explained...

Maybe you could add your rptdesign?

Greetings Marina
Re: How to dynamically control parameter visibility [message #1231013 is a reply to message #1170163] Mon, 13 January 2014 16:03 Go to previous message
Michael Murphy is currently offline Michael MurphyFriend
Messages: 3
Registered: October 2013
Junior Member
Hi Marina,

Apologies for the delay in the reply.

From your reply above, the following looks like what I want, but I suspect we are at cross purposes. You are applying a visibility control on an output, but I want visibility control on a parameter.

Or you take param_2 and param_3 in the same grid for example per drag and drop and use properties->visibility->hide element for specific outputs. For param_2 you write:
params["param_1"].value=="B" and for param_3 is hidden for params["param_1"].value=="A"


I can see how to control data in the report layout

index.php/fa/17225/0/


but not for a parameter:


index.php/fa/17226/0/


Am I missing something..... Sad


eclipse.buildId=4.3.0.M20130911-1000 and Birt 4.2
  • Attachment: Capture1.JPG
    (Size: 63.04KB, Downloaded 1731 times)
  • Attachment: Capture2.JPG
    (Size: 75.00KB, Downloaded 1702 times)

[Updated on: Mon, 13 January 2014 16:06]

Report message to a moderator

Previous Topic:missing chart
Next Topic:2.5 to 4.3 upgrade
Goto Forum:
  


Current Time: Sat Apr 27 05:03:10 GMT 2024

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

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

Back to the top