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)
How to Replace whole query in dataset based on Report Parameter
kcsekhar25
<p>Hi All,</p>
<p>i want to replace the whole query based on the Report Parameters.</p>
<p>below is my scenario.</p>
<p> </p>
<p>i have a report with parameter having Radio Button Options,see the attached for parameters section.</p>
<p>the parameter values are</p>
<p><strong> USA</strong></p>
<p><strong> All</strong></p>
<p> </p>
<p>when i have selected <strong>USA </strong>below query should be used in dataset.</p>
<p> </p>
<p><span style="color:rgb(147,26,104);font-family:Monaco;font-size:11px;">select</span><span style="font-family:Monaco;font-size:11px;color:rgb(0,0,0);"> </span><span style="color:rgb(147,26,104);font-family:Monaco;font-size:11px;">*</span><span style="font-family:Monaco;font-size:11px;color:rgb(0,0,0);"> </span></p>
<p style="font-size:11px;font-family:Monaco;"><span style="color:#931a68;">from</span> contacts</p>
<p style="font-size:11px;font-family:Monaco;"><span style="color:#931a68;">where</span> primary_address_country='USA'</p>
<p style="font-size:11px;font-family:Monaco;"> </p>
<p style="font-size:11px;font-family:Monaco;">when i have selected <strong>All ,</strong>below query should be used in dataset.</p>
<p style="font-size:11px;font-family:Monaco;"> </p>
<p style="font-size:11px;font-family:Monaco;"><span style="color:rgb(147,26,104);">select</span><span style="color:rgb(0,0,0);"> </span><span style="color:rgb(147,26,104);">*</span><span style="color:rgb(0,0,0);"> </span></p>
<p style="font-size:11px;font-family:Monaco;"><span style="color:#931a68;">from</span> contacts</p>
<p style="font-size:11px;font-family:Monaco;"> </p>
<p style="font-size:11px;font-family:Monaco;"> </p>
<p style="font-size:11px;font-family:Monaco;"> </p>
<p style="font-size:11px;font-family:Monaco;"> </p>
<p style="font-size:11px;font-family:Monaco;">please let me know your thoughts how to achieve this.</p>
<p style="font-size:11px;font-family:Monaco;">i am hoping that we can handle it by means of SQL itself without need of javascript.</p>
<p style="font-size:11px;font-family:Monaco;"> </p>
<p style="font-size:11px;font-family:Monaco;">if we need javascript please do let me know on how to achieve this with multiple alternatives.</p>
<div> </div>
<div> </div>
Find more posts tagged with
Comments
kcsekhar25
<p>got the solution.</p>
<p>need to use javascript in beforeOpen method of the dataset as below.</p>
<p> </p>
<p>if(params["country"].value=="USA"){</p>
<div> this.queryText = this.queryText + " where primary_address_country='USA';";</div>
<div>}</div>
<div>else{</div>
<div> this.queryText = this.queryText + " where primary_address_country in ('USA','Canada')";</div>
<div>}</div>
<div> </div>
<div> </div>
<div>Thanks</div>
<div>chandu</div>
kcsekhar25
<p>continuing the above i am trying the below scenario.</p>
<p> </p>
<p> </p>
<p>instead of displaying the dynamic query based on report parameter i want to apply that to a other report parameter.</p>
<p>i have two datasets -</p>
<p> </p>
<p>one is for report data which has query select * from contacts where primary_address_country=? and linked second report parameter to this dataset parameter.</p>
<p> </p>
<p>query for second dataset is select * from contacts and it is binded to second report parameter <strong>Countries.</strong></p>
<p> </p>
<p> </p>
<p>i have two parameters like</p>
<p><strong>Country -</strong> which is a radio button and has static values like<strong> USA ,All</strong></p>
<p><strong>Countries - </strong>this is a dynamic parameter and want to populate country data for this parameter based on the parameter <strong>Country.</strong></p>
<p> </p>
<p> </p>
<p>i applied the same logic as above but it is always to going to else clause even if i have selected USA In first parameter.</p>
<p> </p>
<p> </p>
<p>now when i have selected USA the second report parameter which is of list box should display USA in th list box</p>
<p> and when i have selected all it should fetch me all countries in the drop down or the query in else clause?</p>
<p> </p>
<p> </p>
<p> </p>
<p>please suggest me where i am going wrong.</p>
<p> </p>
<p>i have used parameter groups and individual parameters as well but it is still not working as expected.</p>