{"id":14116,"date":"2018-05-09T07:13:07","date_gmt":"2018-05-09T07:13:07","guid":{"rendered":"https:\/\/kb.sambapos.com\/?p=14116"},"modified":"2018-05-09T07:13:07","modified_gmt":"2018-05-09T07:13:07","slug":"9-1-9-custom-report-filtering-and-grouping","status":"publish","type":"post","link":"https:\/\/kb.sambapos.com\/en\/9-1-9-custom-report-filtering-and-grouping\/","title":{"rendered":"9.1.9. Custom Report Filtering and Grouping"},"content":{"rendered":"<h2 id=\"basic_use\" class=\"sectionedit2\">Basic Use<\/h2>\n<div class=\"level2\">\n<p>This is the basic structure of a custom report. This report lists order lines of tickets.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14117 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-01-1024x633.jpg\" alt=\"\" width=\"640\" height=\"396\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-01-1024x633.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-01-300x185.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-01-768x475.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-01.jpg 1071w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Adding quantity column to report;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14119 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-02-1024x637.jpg\" alt=\"\" width=\"640\" height=\"398\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-02-1024x637.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-02-300x187.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-02-768x478.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-02.jpg 1064w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Adding quantity summary;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14121 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-03-1024x612.jpg\" alt=\"\" width=\"640\" height=\"383\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-03-1024x612.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-03-300x179.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-03-768x459.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-03.jpg 1108w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<h2 id=\"filtering\" class=\"sectionedit3\">Filtering<\/h2>\n<div class=\"level2\">\n<p>You can filter items by Menu Item Group. You should use (MG=x) expression for that. This report will display only Breakfast items.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14123 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-04-1024x578.jpg\" alt=\"\" width=\"640\" height=\"361\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-04-1024x578.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-04-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-04-768x433.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-04.jpg 1173w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Another report will be added to display Misc Items. To separate reports from each other it is used\u00a0<code>&gt;Label<\/code>\u00a0syntax to add bold lines between reports.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14125 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-05-1024x578.jpg\" alt=\"\" width=\"640\" height=\"361\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-05-1024x578.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-05-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-05-768x433.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-05.jpg 1173w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<h2 id=\"grouping\" class=\"sectionedit4\">Grouping<\/h2>\n<div class=\"level2\">\n<p>You can add unlimited number of reports to display more categories. However it will be hard to prepare a report if you have more menu categories. You can use \u201cParameter List\u201d feature instead of addding a report for each filter value you need. Some report will be prepared by using a parameter list.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14127 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-06-1024x580.jpg\" alt=\"\" width=\"640\" height=\"363\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-06-1024x580.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-06-300x170.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-06-768x435.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-06.jpg 1168w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>You&#8217;ll probably want all Menu Categories that exists in that report. Instead of hardcoding all groups one by one you can use another report tag to fetch these values. You should replace @Breakfast,Misc line with a report tag so your parameter list will generate automatically.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14129 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-07-1024x578.jpg\" alt=\"\" width=\"640\" height=\"361\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-07-1024x578.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-07-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-07-768x433.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-07.jpg 1173w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Still same report generates but there is no hardcoded value so as we add new menu item groups to SambaPOS they&#8217;ll appear in report automatically.<\/p>\n<p>It is time to execute\u00a0<code>{REPORT ORDER DETAILS:O.ItemGroup.asc::,}<\/code>\u00a0tag individually to show what it exactly returns.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14131 size-large\" src=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-08-1024x578.jpg\" alt=\"\" width=\"640\" height=\"361\" srcset=\"https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-08-1024x578.jpg 1024w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-08-300x169.jpg 300w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-08-768x434.jpg 768w, https:\/\/kb.sambapos.com\/wp-content\/uploads\/2018\/05\/9-1-9-Custom-Report-Filtering-and-Grouping-08.jpg 1172w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>That generates a comma separated list of Menu Item groups that appears in the report. Being able to get menu groups that exists in report is a great feature so if you normally have a \u201cPizza\u201d group but it does not exists in the report a blank section will not appear for it.<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Basic Use This is the basic structure of a custom report. This report lists order lines of tickets. Adding quantity column to report; Adding quantity summary; Filtering You can filter items by Menu Item Group. You should use (MG=x) expression for that. This report will display only Breakfast items. Another report will be added to [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-14116","post","type-post","status-publish","format-standard","hentry","category-reports"],"_links":{"self":[{"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/posts\/14116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/comments?post=14116"}],"version-history":[{"count":1,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/posts\/14116\/revisions"}],"predecessor-version":[{"id":14133,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/posts\/14116\/revisions\/14133"}],"wp:attachment":[{"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/media?parent=14116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/categories?post=14116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.sambapos.com\/en\/wp-json\/wp\/v2\/tags?post=14116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}