Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
optional parameter
sumathra
<p>Hi...i have created a four parameter like product line,country,state,city now i have to pass parameter in before-open like </p><div><pre class="_prettyXprint">if (params["productline"].value && params["country"].value){q1=this.queryText = this.queryText + " AND PRODUCTLINE = '" + params["productline"].value +"'"+" and COUNTRY = '" + params["country"].value + "'"+"group by country,state,city,productline,buyprice,msrp,CLASSICMODELS.ORDERS.ORDERDATE"; Packages.java.lang.System.out.println ("Query1:" +q1);}else if (params["productline"].value && params["state"].value ){q2=this.queryText = this.queryText + " AND productline = '" + params["productline"].value +"'"+" and state = '" + params["state"].value + "'"+ " group by country,state,city,productline,buyprice,msrp,CLASSICMODELS.ORDERS.ORDERDATE";Packages.java.lang.System.out.println ("Query2:" +q2);}else {q3=this.queryText = this.queryText + " AND productline = '" + params["productline"].value +"'"+" and city = '" + params["city"].value + "'"+ " group by country,state,city,productline,buyprice,msrp,CLASSICMODELS.ORDERS.ORDERDATE";Packages.java.lang.System.out.println ("Query3:" +q3);}</pre><p>i had unchecked the is-required option its pass well but null value is present in list box ..</p><p>So Now user can select any parameter like </p><p> </p><p>i) product line and country</p><p>ii) product line and state</p><p>iii) product line and city</p><p> </p><p>is this way correct way or is there some other way???can body help on this....</p></div>
Find more posts tagged with
Comments
kclark
<p>Without testing it, it looks correct. Are you not getting the expected results or getting some error?</p>
sumathra
<p>thank for reply.....now the thing is user may select combination option so i have created a radio-button depends on visibility list box will display </p><p><strong>let us consider the example::</strong></p><p><span style="font-size:14px;color:rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;">i)if user select a </span><span>Product line</span><span style="font-size:14px;"> and country some value will display </span></p><p>[color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;font-size:14px;]ii)i[/color][color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;]f user select a[/color][color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;font-size:14px;] [/color]<span>Product line</span><span style="font-size:14px;"> and state </span>[color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;font-size:14px;] some value will display..like wise it go...[/color]</p><p>[color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;font-size:14px;]but its not passing a correct value when we select in custom jsp ...[/color]</p><p>[color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;font-size:14px;]i have attached sample report [/color][color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;font-size:14px;]and jsp[/color][color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;font-size:14px;] for reference[/color]</p><p>[color=rgb(0,0,0);font-family:Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;font-size:14px;]Check and provide a solution for this????[/color]</p><p> </p><p>[font="Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;font-size:14px;"][color=#006400;]Regards::[/color][/font]<br />
[color=#006400;]sumathra[/color]</p>
sumathra
<p>Kindly Reply for this thread????</p>
sumathra
<p>Any Help it will be useful?????</p>
sumathra
<p>Any Updates?????i am so stuck a lot here i cant move to next Level?????</p>
fmakwsi
<p>show a screen of the wrong output pls :-)</p>
sumathra
<p>Look at this link</p><p> </p><p><a data-ipb='nomediaparse' href='
http://i.imgur.com/jBDDtx5.png'>http://i.imgur.com/jBDDtx5.png</a></p><p> </p><p><a
data-ipb='nomediaparse' href='
http://i.imgur.com/ylPpptA.png'>http://i.imgur.com/ylPpptA.png</a></p><p>here scenario is
i kept product line as constant but user may select any radio button like country,state,city.....first if i select </p><p> </p><p>i)product line and country first time it pass well by above query</p><p>ii)but if i select product line and state again it passing to country not state show achieve this?????</p>
SyN
<p>Hi sumatra,</p><p> </p><p>i'm not sure if i'm getting the problem right so i'll try to recapitulate:</p><p> </p><ul class='bbc'><li>You have a jsp collecting values from the user.</li><li>When you want to hand over the user-chosen values to the report they do not show up.</li></ul><p> </p><p>Is that correct?</p>
sumathra
<p>Yes ,am[color=rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;] collecting values from the user .yes ,[/color][color=rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;]When you want to hand over the user-chosen values to the report they do not show up a correct data its not clear a previous value while selecting Radio button[/color]</p><p> </p><p>for example::</p><p> </p><p> first user select Country like Germany and other list box value like Classic car at the time data will appear and then for other option like select state like **** and other list box like value Classic car at the time data will appear </p><p> </p><p>but here for the first time data will appear correctly ...if i select Randomly the Radio button the previous list box value is not clear ..???</p>
SyN
<p>Ok, again: I'm trying to get this right.</p><p> </p><ul class='bbc'><li>You select "Country" and product line "Classic cars", press "Run Report" and the report does not get the parameters.</li><li>After that, you select "State" and product line "Classic cars", press "Run Report" and the report gets the parameters.</li></ul><p> </p><p>Correct? Do you have any defaults defined for your Parameters?</p><p> </p><p>I'm quite sure i can't help you with that, but i want to correctly understand you problem at least.
</p>
sumathra
<p>k fine </p><ul class='bbc'><li>if i select "Country" and product line "Classic cars", press "Run Report" and the report data well --1 screenshot</li><li>if i select "State" and product line "Classic cars", press "Run Report" and the report the report data well --2 screenshot</li><li>if i select "city" and product line "Classic cars", press "Run Report" and the report the report data well --3 screenshot</li></ul><p style="margin:0px;">but again </p><ul class='bbc'><li>if i again select "country" and product line "Classic cars", press "Run Report" and the report data appear for city only not for country --4 screenshot ...thats my problem so previous value is not clear ...</li></ul><p>Look at the Screenshot..</p>
SyN
<p>Ok, now i got it, thanks for clarification.
</p><p> </p><p>As i guessed, i'm afraid i can't help you. But just to give it a thought:</p><ul class='bbc'><li>Have you tried with different browsers?</li><li>Can you let the jsp output the selection for debugging?</li><li>Maybe a little onChange-Eventtrigger for the jsp to get the parameter right?</li></ul>
sumathra
<p>yes i tried <span>with different browsers...i don't have an idea where i am stuck up and where to start ??? i will try up with u r points.....</span></p><p><span>could some body help out of this problem please ...???</span></p>
fmakwsi
<blockquote class="ipsBlockquote" data-author="sumathra" data-cid="125340" data-time="1390996366"><div><p>k fine </p><ul class='bbc'><li>if i select "Country" and product line "Classic cars", press "Run Report" and the report data well --1 screenshot</li><li>if i select "State" and product line "Classic cars", press "Run Report" and the report the report data well --2 screenshot</li><li>if i select "city" and product line "Classic cars", press "Run Report" and the report the report data well --3 screenshot</li></ul><p>but again </p><ul class='bbc'><li>if i again select "country" and product line "Classic cars", press "Run Report" and the report data appear for city only not for country --4 screenshot ...thats my problem so previous value is not clear ...</li></ul><p>Look at the Screenshot..</p></div></blockquote><p> </p><p>Check if the parameter for the city is set to null or "" on your last cenario, dunno exactly how u structered but actually it filters for the first parameter it gets. No time to have a look on it. and try to debugg the values for the parameters looks like something dont fit in there</p><pre class="_prettyXprint _lang-">if (params["productline"].value && params["country"].value){q1=this.queryText = this.queryText + " AND PRODUCTLINE = '" + params["productline"].value +"'"+" and COUNTRY = '" + params["country"].value + "'"+"group by country,state,city,productline,buyprice,msrp,CLASSICMODELS.ORDERS.ORDERDATE"; Packages.java.lang.System.out.println (params["productline"].value + " and " + params["country"].valuePackages.java.lang.System.out.println("I am in 1");}else if (params["productline"].value && params["state"].value ){q2=this.queryText = this.queryText + " AND productline = '" + params["productline"].value +"'"+" and state = '" + params["state"].value + "'"+ " group by country,state,city,productline,buyprice,msrp,CLASSICMODELS.ORDERS.ORDERDATE";Packages.java.lang.System.out.println (params["productline"].value + " and " + params["state"].value);Packages.java.lang.System.out.println("I am in 2");}else {q3=this.queryText = this.queryText + " AND productline = '" + params["productline"].value +"'"+" and city = '" + params["city"].value + "'"+ " group by country,state,city,productline,buyprice,msrp,CLASSICMODELS.ORDERS.ORDERDATE";Packages.java.lang.System.out.println (params["productline"].value + " and " + params["city"].value);Packages.java.lang.System.out.println("I am in 3");}</pre><p>try it with this</p>
404040
<p>Hi..i dono whether Report parameter clear option available in Before open method in birt then it easy to do it.....
</p>
fmakwsi
<p>ye seems to be a problem with it. Lets wait on his answere</p>
sumathra
<p>That's guys i cant able to find any method or other way so only i approach forum ..
if any body well know kindly update report and jsp its useful to learn from u all....</p><p> </p><p> </p><p>Regards:</p><p>sumathra </p>
fmakwsi
<p>you've tried what i've posted? if yes post a screen of the output</p>
sumathra
<p>look at the image and console mode which print message </p>
fmakwsi
<p>try it with exactly the same cases as you did it above</p>
sumathra
<p>my thought is only if we set a hidden value in report and it have to pass to Radio button in jsp page and according to click it have to pass listbox then only it will provide correct data for each value but it too fail ...</p>
sumathra
<p>Any Body Help on this thread please,please????</p><p>Here is the link which i had tried ...refer the link</p><p><a data-ipb='nomediaparse' href='
https://www.dropbox.com/s/h8zql63n1fj5ps4/jsp and report.zip'>https://www.dropbox.com/s/h8zql63n1fj5ps4/jsp and report.zip</a></p>
;
johnw
<p>The problem is in your parameter page, not in the BIRT report.</p><p> </p><p>Here is what is happening. If you select Country, it works fine.</p><p> </p><p>If you select State, it works fine.</p><p> </p><p>If you select City, it works fine.</p><p> </p><p>Heres the problem, you're not clearing any of the previous parameter values. The script in the BIRT report goes in that order. So when you go to select a different country, it sees the lowest value in the hierarchy is the last city you set, so it keeps that value. You are only setting the styles to hide the values, not null out the other values. You need to set the other values to null so the report logic can work correctly. </p><p> </p><p>Fix your parameter page. That will solve your immediate problem. </p>
sumathra
<p>Thanks for u r reply ..i know that is in Parameter page but i dono how to clear it ..is its possible to update my report it will help to learn from now and future ....</p><p> </p><p> </p><p>Regards:</p><p>sumathra</p>
johnw
<p>Thats the problem, there is no change you can make in the report design that will fix the problem. The problem is not in the report design. The problem is in the parameter page. In the function fun(), you need to clear the form values for the two parameters not being used.</p><p> </p><p>So if country is selected, you need to clear state and city. If state is selected, country and city need to be cleared. And if city is selected, country and state need to be cleared. </p><p> </p><p>If you don't do this, then the JSP page will pass in previous values. And when you get to selecting city, it will always pass in city.</p><pre class="_prettyXprint _lang-js"> function fun(s) { var a = document.getElementById("countrys").value; // alert("a"+a); var c = document.getElementById("states").value; // alert("c"+c); var d = document.getElementById("citys").value; // alert("d"+d); if (s == a) { //************************ clear other two values **************************************** document.getElementById("states").value = ""; document.getElementById("citys").value = ""; //x=1; //alert("country"); document.getElementById("country").style.display = ''; document.getElementById("state").style.display = 'none'; document.getElementById("city").style.display = 'none'; document.getElementById("rptFlag").value = 'country'; alert("A:"+document.getElementById("rptFlag").value); } else if (s == c) { //************************ clear other two values **************************************** document.getElementById("countrys").value = ""; document.getElementById("citys").value = ""; // y=1; //alert("state"); document.getElementById("state").style.display = ''; document.getElementById("country").style.display = 'none'; document.getElementById("city").style.display = 'none'; document.getElementById("rptFlag").value = 'state'; alert("B:"+document.getElementById("rptFlag").value); } else if (s == d) { //************************ clear other two values **************************************** document.getElementById("countrys").value = ""; document.getElementById("states").value = ""; // z=1; //alert("city"); document.getElementById("city").style.display = ''; document.getElementById("country").style.display = 'none'; document.getElementById("state").style.display = 'none'; document.getElementById("rptFlag").value = 'city'; alert("C:"+document.getElementById("rptFlag").value); } }</pre>
sumathra
<p>Ya i did this before itself but its not work.....we need to clear a list box value or radio button value???</p>
johnw
<p>List box values. Set them to either blank or null. Try setting to null instead.</p><p> </p><p>It might be possible it's a bug in the tag libs. I don't ever use them. </p><p> </p><p>Either way, it's not a problem with the report design itself. I can run it multiple times in a row with different values and it works fine for each.</p>
sumathra
<p>I had tried with empty value and Null value in parameter page but again showing same result no change in it...</p><p> </p><div><pre class="_prettyXprint"><%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><LINK REL=StyleSheet HREF="divstyle.css" TYPE="text/css"><script language="JavaScript" type="text/javascript">function fun(s){ var a = document.getElementById("countrys").value;// alert("a"+a);var c = document.getElementById("states").value;// alert("c"+c);var d = document.getElementById("citys").value;// alert("d"+d);if (s == a){// document.getElementById("state").value = "";// document.getElementById("city").value = ""; document.getElementById("state").value = null;document.getElementById("city").value = null;//x=1;//alert("country");document.getElementById("country").style.display = '';document.getElementById("state").style.display = 'none';document.getElementById("city").style.display = 'none';document.getElementById("rptFlag").value = 'country';alert("A:"+document.getElementById("rptFlag").value);}else if (s == c){// document.getElementById("country").value = "";// document.getElementById("city").value = "";document.getElementById("country").value =null;document.getElementById("city").value = null;// y=1;//alert("state"); document.getElementById("state").style.display = '';document.getElementById("country").style.display = 'none';document.getElementById("city").style.display = 'none';document.getElementById("rptFlag").value = 'state';alert("B:"+document.getElementById("rptFlag").value); } else if (s == d){// document.getElementById("country").value = "";// document.getElementById("state").value = "";document.getElementById("country").value = null;document.getElementById("state").value = null;// z=1;//alert("city");document.getElementById("city").style.display = '';document.getElementById("country").style.display = 'none';document.getElementById("state").style.display = 'none';document.getElementById("rptFlag").value = 'city';alert("C:"+document.getElementById("rptFlag").value); }}function fu(){/* table2 */document.getElementById("country").style.display = 'none';document.getElementById("state").style.display = 'none';document.getElementById("city").style.display = 'none';}</script></head><body onload="fu()"><table cellpadding="0" cellspacing="0" border="2" bgcolor="pink"><tr><td><input type="radio" name="B" id="countrys" value="country" onclick="fun(this.value)" ></td><td>Country</td><td><input type="radio" name="B" id="states" value="state" onclick="fun(this.value)" ></td><td>State</td><td><input type="radio" name="B" id="citys" value="city" onclick="fun(this.value)" ></td><td>City</td></tr></table><%@ taglib uri="/birt.tld" prefix="birt"%><birt:parameterPage id="birtParm"reportDesign="Reporttry/Trend/sampledbitem.rptdesign"name="item"pattern="run" isCustom="true" target="trend"forceOverwriteDocument="true" showNavigationBar="false"> <birt:paramDef name="productline" id="productline" ></birt:paramDef><birt:paramDef name="country" id="country"></birt:paramDef><birt:paramDef name="state" id="state"></birt:paramDef><birt:paramDef name="city" id="city"></birt:paramDef><birt:paramDef name="MeasureToShow" id="MeasureToShow"></birt:paramDef><birt:paramDef name="rptFlag" id="rptFlag"></birt:paramDef><input type="submit" name="submit" value="Run Report"/></birt:parameterPage><div><IFRAME WIDTH=100% HEIGHT="550" FrameBorder="0" NAME="trend"></IFRAME></div></body></html></pre></div>
johnw
<p>OK, found it. Same logic applies, but it looks like the JSP taglibs have some hidden input parameters that are used. These aren't changed when setting in the script. Let me put together another example real quick...</p>
johnw
<p>Take a look at the attached example. I did a few things.</p><p> </p><p>1) I cleaned up the report design, removed the report parameter that was being used to store the format and moved that to a locally scoped javascript variable. This wasn't necessary. If you need to debug your query, use default parameter values.</p><p> </p><p>2) I fixed the JSP page, which is the root of your problem. You had incorrect named ID's searching for the DIV tags getting values. But the biggest issue is that the parameter page TAGLIB uses hidden input text boxes for the passing of its values. These get set onValueChange for the drop down list, but manually setting the value of the drop down list does not change these hidden input boxes. These can easily be found using Chromes developer tools.</p><p> </p><p>This will now set those values to null when the user changes the Radio box to a new value.</p>