{"id":2163,"date":"2011-08-29T16:34:57","date_gmt":"2011-08-29T08:34:57","guid":{"rendered":"http:\/\/www.finereport.com\/knowledge\/design\/java%e6%8a%a5%e8%a1%a8%e8%bd%af%e4%bb%b6finereport%e5%ae%9e%e7%8e%b0%e5%8a%a8%e6%80%81%e6%98%be%e7%a4%ba%e5%8f%82%e6%95%b0%e6%8e%a7%e4%bb%b6.html"},"modified":"2018-09-11T19:38:28","modified_gmt":"2018-09-11T11:38:28","slug":"dynamic-para","status":"publish","type":"post","link":"https:\/\/frg.fineres.com\/en\/2011\/08\/29\/dynamic-para\/","title":{"rendered":"FineReport display parameter controls dynamically"},"content":{"rendered":"<p>Due to the needs of business, in many cases the need to achieve in a <a href=\"http:\/\/www.finereport.com\/en\/products\" title=\"web report\">web report<\/a> such an effect: When a condition is met, certain conditions before the query is displayed, as shown below, select the annual report, showing in the drop down box control; select month Daily, year and month displays a drop-down box controls; select Daily, displays the date controls: as shown.<br \/>\n<a href=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-1.png\" title=\"annual report date control\"><img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-1.png\" alt=\"annual report date control\" class=\"centered\"><\/a><br \/>\n<a href=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-2.png\" title=\"monthly report date control\"><img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-2.png\" alt=\"monthly report date control\" class=\"centered\"><\/a><br \/>\n<a href=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-3.png\" title=\"daily report date control\"><img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-3.png\" alt=\"daily report date control\" class=\"centered\"><\/a><br \/>\nHere we look at how to achieve these effects in <a href=\"http:\/\/www.finereport.com\/en\" title=\" Web reporting software\"> Web reporting software<\/a> FineReport.<!--more-->\u3002<br \/>\nReport by visible controls (), invisible () attribute controls its visual and non-visual<br \/>\nvar [Widget] = form.getWidgetByName(&#8220;[ParaName]&#8221;); \/\/Get control via control name<br \/>\n[Widget].visible(); \/\/Set the control visibility<br \/>\n[Widget].invisible(); \/\/Set the control Invisible<br \/>\nSpecific steps are as follows:<br \/>\n<b>1. Open report sample<\/b><br \/>\nOpen Sample:<br \/>\n<b>%FR_HOME%WebReportWEB-INFreportletsdocParameterDynamicSQLDynamicSQL.cpt<\/b>\u3002<br \/>\n<b>2. Modify report dataset<\/b><br \/>\nThe dataset amended as follows:<br \/>\n<b>SELECT * FROM \u8ba2\u5355 where 1=1 ${if(type==&#8221;\u65e5\u62a5&#8221;,&#8221;and format(\u8ba2\u8d2d\u65e5\u671f,&#8217;yyyy-mm-dd&#8217;) = &#8216;&#8221; + date + &#8220;&#8216;&#8221;,if(type==&#8221;\u6708\u62a5&#8221;,&#8221;and month(\u8ba2\u8d2d\u65e5\u671f) = &#8220;+ month + &#8221; and year(\u8ba2\u8d2d\u65e5\u671f) = &#8221; + year ,&#8221;and year(\u8ba2\u8d2d\u65e5\u671f) = &#8221; + year ))}<\/b><br \/>\nType parameter type is set to the default value daily, the parameter date set default values \u200b\u200bfor the string value 2010-01-03.<br \/>\n<b>3. Reports table-like modification<\/b><br \/>\nThe table-like style modified as follows:<br \/>\n<a href=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-4.png\" title=\"Report template\"><img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-4.png\" alt=\"Report template\" class=\"centered\"><\/a><br \/>\nSet to A3 forms, custom data, the actual value is displayed with the corresponding values \u200b\u200bwere: daily, date; monthly, years; annual, year.<br \/>\nAdd the following formula in cell B3:<b>=if(type==&#8221;\u65e5\u62a5&#8221;,$date,if(type==&#8221;\u6708\u62a5&#8221;,$year+&#8221;.&#8221;+$month,$year))<\/b><br \/>\n<b>4. Report Parameters interface settings<\/b><br \/>\nSet the parameter interface into the following styles:<br \/>\n<a href=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-5.png\" title=\"report parameter interface\"><img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-5.png\" alt=\"report parameter interface\" class=\"centered\"><\/a><br \/>\nSet the control type parameter type drop-down box, custom value and the actual value is displayed values \u200b\u200bare daily, monthly and annual reports.<br \/>\nSet the parameters for the control type year drop-down box, custom values \u200b\u200band actual values \u200b\u200bare displayed for 2010,2011.<br \/>\nSet the control type parameter month for drop-down box, the value equation, fill in the actual value of the formula = range (1,6) can be.<br \/>\nSet the control type parameter date for date, the return value type is the default string.<br \/>\n<b>5. JS Event<\/b><br \/>\nTo the parameter type drop-down box controls to increase the edited event, the specific JS code is as follows: Report Controls js code<br \/>\n<a href=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-6.jpg\" title=\"\u62a5\u8868\u63a7\u4ef6js\u4ee3\u7801\"><img src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/dynamic-para-6.jpg\" alt=\"\u62a5\u8868\u63a7\u4ef6js\u4ee3\u7801\" class=\"centered\"><\/a><br \/>\n<b>Note: This code determine the type parameter value, if daily newspaper, only the date controls, if monthly, year and month are displayed controls, if the annual report, only the year controls.<\/b><br \/>\n<b>6. Save the report template<\/b><br \/>\nClick on the preview page, the effect is as shown above.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Due to the needs of business, in many cases the need to&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[111],"tags":[117],"_links":{"self":[{"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/posts\/2163"}],"collection":[{"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/comments?post=2163"}],"version-history":[{"count":1,"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/posts\/2163\/revisions"}],"predecessor-version":[{"id":4743,"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/posts\/2163\/revisions\/4743"}],"wp:attachment":[{"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/media?parent=2163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/categories?post=2163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/tags?post=2163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}