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 Parameters
Priya R
<p>Hi,</p>
<p> </p>
<p>Is there a way we can make sure that at least one parameter is selected from a list of optional parameters in BIRT when we run the report?</p>
<p> </p>
<p>My requirement is, I have 2 parameters in my report but both are optional. When user run the report, we need to make sure that at least one of them is selected. How do I do that in BIRT.</p>
<p> </p>
<p>Thanks,</p>
<p>Pri </p>
Find more posts tagged with
Comments
pricher
<p>Hi,</p>
<p> </p>
<p>If by "optional" you mean "not required" (i.e. unchecking the "Is Required" box in the parameter definition window), then you are contradicting yourself by wanting to make sure at least one value is selected. A parameter is either required, or not.</p>
<p> </p>
<p>Regards,</p>
<p> </p>
<p>P.</p>
Priya R
<p>Hi Pierre,</p>
<p> </p>
<p>Thanks for your reply. If I check the "Is Required" box in the parameter definition window, I have to enter the value all the time.</p>
<p> </p>
<p>But my requirement is, out of 2 parameters (eg: Creation_Date & Enforcement_Date) user should have the flexibility to</p>
<p>choose which parameter to enter</p>
<p> - > Enter Creation_Date and leave Enforcement_Date blank</p>
<p> or</p>
<p> -> Leave Creation_Date blank and Enter Enforcement_Date</p>
<p> </p>
<p>Is this possible to do in BIRT?</p>
<p> </p>
<p>Thanks,</p>
<p>Pri</p>
pricher
<p>Hi,</p>
<p> </p>
<p>If I understand correctly, users need to input one and only one of the two parameters. You would probably be better off to create your own custom parameter page for that. </p>
<p> </p>
<p>If you want to do it in BIRT, you could leave your two parameters not required. Then, you create a third parameter that you keep hidden. This parameter will be used to validate the two other parameters using its validate() method:</p>
<pre class="_prettyXprint _lang-">
if (params["Creation_Date"].value == null) {
if (params["Enforcement_Date"].value != null) {
true;
}
} else if (params["Enforcement_Date"].value == null) {
if (params["Creation_Date"].value != null) {
true;
}
}
</pre>
<p>The only problem with this approach is that you cannot control the error message.</p>
<p> </p>
<p>I have attached a sample report that shows how it works.</p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
Priya R
<p>Ok Thanks Pierre.. I will try..</p>
<p> </p>
<p>Thanks,</p>
<p>Priya</p>