{"id":3549,"date":"2016-06-14T03:00:22","date_gmt":"2016-06-13T19:00:22","guid":{"rendered":"http:\/\/www.finereport.com\/en\/?p=3549"},"modified":"2019-10-14T16:18:11","modified_gmt":"2019-10-14T08:18:11","slug":"fuzzy-query","status":"publish","type":"post","link":"https:\/\/frg.fineres.com\/en\/2016\/06\/14\/fuzzy-query\/","title":{"rendered":"Description of Fuzzy Query."},"content":{"rendered":"<p>Fuzzy query is a simple method to query data meeting certain formats in <a title=\"FineReport BI and reporting tool report designer\" href=\"http:\/\/www.finereport.com\/en\/features\/report-designer\" target=\"_blank\">report designer<\/a>. So let&#8217;s have a look!<\/p>\n<h3>1. Problem description<\/h3>\n<p>Fuzzy query in report designer is a simple method to query data meeting certain formats. For example, if you want to query all data containing character \u201ca\u201d, you can use fuzzy query.<\/p>\n<h3>2. Fuzzy query syntax<\/h3>\n<p>In fuzzy query of Finereport <a href=\"http:\/\/www.finereport.com\/en\/\" target=\"_blank\"><span style=\"color:blue;\">BI<\/span><\/a>, \u201c_\u201d represents a single character and \u201c%\u201d represents any character for matching. Some common formats are as follows:<\/p>\n<p>Select * from Table Name where Column Name like &#8216;%&#8217;; \/\/ Query All<\/p>\n<p>Select * from Table Name where Column Name like &#8216;x&#8217;; \/\/ Complete Matching Query<\/p>\n<p>Select * from Table Name where Column Name like &#8216;_x&#8217;; \/\/if right is x, there is one character in the front<\/p>\n<p>Select * from Table Name where Column Name like &#8216;__x&#8217;; \/\/if right is x, there are two bytes of characters in the front<\/p>\n<p>Select * from Table Name where Column Name like &#8216;x__&#8217;; \/\/if left is x, there are two bytes of characters in the back<\/p>\n<p>Select * from Table Name where Column Name like &#8216;%x&#8217;; \/\/if right is x, there are any bytes of characters in the front<\/p>\n<p>Select * from Table Name where Column Name like &#8216;x%&#8217;; \/\/if left is x, there are any bytes of characters in the back<\/p>\n<p>Select * from Table Name where Column Name like &#8216;%x%&#8217;; \/\/if middle is x, there are any bytes of characters in middle<\/p>\n<p>Combine parameter fuzzy query (replace the above x with ${name}):<\/p>\n<p>Select * from Table Name where Column Name like &#8216;${name}&#8217;;<\/p>\n<p>Select * from Table Name where Column Name like &#8216;%${name}&#8217;;<\/p>\n<p>And so on.<\/p>\n<h3>3. Example<\/h3>\n<p>Use fuzzy query to realize that \u201cif parameter is Null, select All\u201d<\/p>\n<p>Create a new workbook and add data set ds1 with sql statement: <span style=\"color: purple;\"><strong>SELECT*FROM Sales Volume WHERE Area like &#8216;%${area}&#8217;<\/strong><\/span><\/p>\n<p><strong>Effect viewing<\/strong><\/p>\n<p>Click Preview button on the Data Set Panel to pop up Parameter dialog. For example, if \u201cEast China\u201d is input, the system only displays product sales volume in East China:<\/p>\n<p><img class=\"aligncenter\" src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/201661301.png\" alt=\"\" \/><\/p>\n<p>If no parameter value is input, the system will display product sales volumes of all areas:<\/p>\n<p><img class=\"aligncenter\" src=\"http:\/\/www.finereport.com\/en\/wp-content\/themes\/fanruan\/images\/201661302.png\" alt=\"\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fuzzy query is a simple method to query data meeting ce&#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\/3549"}],"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=3549"}],"version-history":[{"count":6,"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/posts\/3549\/revisions"}],"predecessor-version":[{"id":8257,"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/posts\/3549\/revisions\/8257"}],"wp:attachment":[{"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/media?parent=3549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/categories?post=3549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frg.fineres.com\/en\/wp-json\/wp\/v2\/tags?post=3549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}