Highlighted
Daniel P_ Marques Absent Member.
Absent Member.
1856 views

How to check a radiobutton selection o before opening a report in BIRT?

Jump to solution

Hi Everyone!

I have a report that needs to have a validation before showing the results, it can be validated through a "radiobutton" for example where I need to recalculate (refresh data) every time the selection changes. How can I do this? I think it can be done using the "Report Parameters" of type "Boolean" displaying a "Radio button" type object but I sincerely didn't know how to implement.

Can anyone help me with some tips or examples?

Regards,

Dan 

0 Likes
1 Solution

Accepted Solutions
Micro Focus Contributor
Micro Focus Contributor

RE: How to check a radiobutton selection o before opening a report in BIRT?

Jump to solution
Hi,

the sample you showed describes a standalone BIRT Viewer use case - this is not how BIRT is integrated in Silk Central.
The report iframe contains the rendered HTML that is produced by the BIRT runtime on a chart server, parameters added to the URL of the iframe are not passed to the BIRT runtime.

You can however add parameters to the Silk Central report query (used or unused, e.g. as a comment as described before). Those parameters are passed to the BIRT runtime and can be accessed via their "rp_"-prefixed name in BIRT. I can provide an example if required.

Regards,
Roland Kern
0 Likes
7 Replies
Daniel P_ Marques Absent Member.
Absent Member.

RE: How to check a radiobutton selection o before opening a report in BIRT?

Jump to solution

Just to complement this post, 'cause I got some answers testing new possibilities and figured out that the report is always setting the parameters to the default value after location.replace() method invocation. I have created a form in a "Aa text" like bellow:

<form  name="cbform">
<INPUT TYPE=CHECKBOX NAME="mycheckbox" <VALUE-OF>if(params["automation"].value){"checked";} else{"";}</VALUE-OF> onClick="reloadPage();">Com automação</INPUT>

<script type="text/javascript">
function reloadPage()
{
var curLocation = new String(location.href);
var targetLocation = new String();
alert('curLocation = ' + curLocation);
if(curLocation.indexOf("&automation=") == -1)
{
targetLocation += curLocation + "&automation=";
}
else
{
targetLocation += curLocation.substring(0, curLocation.indexOf("&automation=")+12);
}
targetLocation += document.cbform.mycheckbox.checked;
location.replace(targetLocation); <-- It is reloading the document with a new URL using "&parameter=true" but Silk Central is always setting again to default value 
}

 

And this is my parameter created on BIRT:

<scalar-parameter name="automation" id="78">
<property name="hidden">false</property>
<property name="valueType">static</property>
<property name="isRequired">true</property>
<property name="sortBy">label</property>
<property name="sortDirection">asc</property>
<property name="dataType">boolean</property>
<property name="distinct">true</property>
<simple-property-list name="defaultValue">
<value type="constant">true</value>
</simple-property-list>
<list-property name="selectionList"/>
<property name="paramType">simple</property>
<property name="controlType">check-box</property>
<structure name="format"/>
</scalar-parameter>

0 Likes
Micro Focus Contributor
Micro Focus Contributor

RE: How to check a radiobutton selection o before opening a report in BIRT?

Jump to solution
Hi,

I don't know your exact use case, but the following could work if every user only has to confirm once per report, and the possibility of overriding the value on the "Parameters" tab of the Silk Central report is not a problem:

Add a parameter (e.g. "checked") to the query of the Silk Central report, e.g. as a comment in the SQL:
-- $(checked|false|)

Add the corresponding parameter "rp_checked" to the BIRT template and bind the visibility of your report content to this value:
Visibility - Hide Element - Expression: !params["rp_checked"].value

Parameters contained in the Silk Central query are passed to BIRT, prefixed with "rp_". Those parameters are also bookmarkable and are overwritten for the user.
So in the click handler of your checkbox, don't reload the report, but create a full bookmark URL including the new parameter and apply it to the parent window:

<input type="checkbox" <VALUE-OF>if (params["rp_checked"].value) {"checked"}</VALUE-OF> onclick="var url = '<VALUE-OF>params["currFrontendURL"].value</VALUE-OF>/TM/Reports?pId=<VALUE-OF>params["currProjectID"].value</VALUE-OF>&nRep=<VALUE-OF>params["currReportFilterID"].value</VALUE-OF>&rp_checked=' + this.checked; parent.location.href = url;">

Regards,
Roland Kern
0 Likes
Daniel P_ Marques Absent Member.
Absent Member.

RE: How to check a radiobutton selection o before opening a report in BIRT?

Jump to solution

Hei Kern,

Thanks for the suggestion, in fact I don't have a parameter in the SQL report once I've already mined all data needed, I just wanna display data or not based on the checkbox status. I've got all I need on this link http://birtworld.blogspot.com.br/2007/03/birt-milestone-5-new-and-notable.html the only difference is that this is not running on Silk Central reports. In Silk Central for exemple the form is not submitting and that's the reason why I'm handling the window.onload method.

Please let me know how to renderize the form inside the "iframe" report area.

Best regards,

Dan

0 Likes
Micro Focus Contributor
Micro Focus Contributor

RE: How to check a radiobutton selection o before opening a report in BIRT?

Jump to solution
Hi,

the sample you showed describes a standalone BIRT Viewer use case - this is not how BIRT is integrated in Silk Central.
The report iframe contains the rendered HTML that is produced by the BIRT runtime on a chart server, parameters added to the URL of the iframe are not passed to the BIRT runtime.

You can however add parameters to the Silk Central report query (used or unused, e.g. as a comment as described before). Those parameters are passed to the BIRT runtime and can be accessed via their "rp_"-prefixed name in BIRT. I can provide an example if required.

Regards,
Roland Kern
0 Likes
Daniel P_ Marques Absent Member.
Absent Member.

RE: How to check a radiobutton selection o before opening a report in BIRT?

Jump to solution
Hi Kern,

Now it's clear, I thought I misunderstood the suggestion. Please, provide me an example if you can, it will be very useful.

Much thanks!

Dan
0 Likes
Daniel P_ Marques Absent Member.
Absent Member.

RE: How to check a radiobutton selection o before opening a report in BIRT?

Jump to solution
Hi Kern,

I tried exactly like your suggestion and bookmarked the entire URL but the parameter always assumes the default value (true in this case). In my SQL I kept the the parameter commented "--$(checked|false|)" but it's not clear if it's working or not, I'm afraid that it's not working correctly. Can you please provide me the example on how to pass the parameter value from SQL to report when the parameter is not part of the SQL query?
Thanks
Dan
0 Likes
Daniel P_ Marques Absent Member.
Absent Member.

RE: How to check a radiobutton selection o before opening a report in BIRT?

Jump to solution
It works!!! \o/ Thanks [mention:d7b415a339244137ab18e29962ab5b46:e9ed411860ed4f2ba0265705b8793d05]
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.