{"id":43873,"date":"2022-10-17T03:01:42","date_gmt":"2022-10-16T17:01:42","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=43873"},"modified":"2022-10-21T18:11:04","modified_gmt":"2022-10-21T08:11:04","slug":"date-range-reporting-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/date-range-reporting-primer-tutorial\/","title":{"rendered":"Date Range Reporting Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/nswstuff.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Date Range Reporting Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/nswstuff.jpg\" title=\"Date Range Reporting Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Date Range Reporting Primer Tutorial<\/p><\/div>\n<p>Are you always satisfied with Search and\/or Advanced Search functionality on websites?  We&#8217;d say &#8220;sometimes&#8221;, but understand that some of the access to &#8220;Advanced Search&#8221; is debatable for webmasters given it can lead to database searches of some complexity, that might slow down their web server considerably.  Just consider a database SQL query &#8230;<\/p>\n<p><code><br \/>\nSELECT * FROM placenamesintheworld WHERE placename = 'Adelaide';<br \/>\n<\/code><\/p>\n<p> &#8230; as distinct from (the one character different) &#8230;<\/p>\n<p><code><br \/>\nSELECT * FROM placenamesintheworld WHERE placename >= 'Adelaide';<br \/>\n<\/code><\/p>\n<p>That one extra &#8220;>&#8221; means little to the SQL interpreter but could mean a lot to web server performance.  When we approach &#8220;Advanced Search&#8221; functionality on public websites, we are not surprised when restrictions are applied.<\/p>\n<p>If you are into data migration you may often know that jobs need to be broken up into manageable chunks of work.  It is the same with &#8220;Advanced Search&#8221; quite often.<\/p>\n<p>And so to day&#8217;s <i>date range<\/i> &#8220;Advanced Search&#8221; requirement we have for today&#8217;s tutorial.   We found on the <a target=_blank href='http:\/\/www.legislation.nsw.gov.au\/'>NSW Government Legislation<\/a> website&#8217;s &#8220;Advanced Search&#8221; &#8220;CCL query&#8221; functionality some inconsistencies when involving queries greater than (ie. using &#8220;>&#8221;) showed inconsistency (perhaps depending on your FirstValid Date start date, we are not sure), but no such inconsistency just involving (date) equality (ie. only involving &#8220;=&#8221; as any operator in the CCL query).   So we decided to break the job up, writing an inhouse interface date range asker that behind the scenes only uses equality query parts to the several CCL queries it runs.<\/p>\n<p>This is a PHP job, because &#8230;<\/p>\n<ul>\n<li>it needs to output file data (in the output HTML report) &#8230; and &#8230;<\/li>\n<li>it uses <a target=_blank title='file-get_contents PHP method information' href='http:\/\/php.net\/manual\/en\/function.file-get-contents.php'>file_get_contents<\/a> to extract its report data<\/li>\n<\/ul>\n<p>You can see how today&#8217;s PHP <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/nswstuff.php_GETME\" title=\"nswstuff.php\">nswstuff.php<\/a> works at this <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/nswstuff.php\" title=\"Click picture\">live run<\/a> link.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d43873' onclick='var dv=document.getElementById(\"d43873\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/report\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d43873' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Are you always satisfied with Search and\/or Advanced Search functionality on websites? We&#8217;d say &#8220;sometimes&#8221;, but understand that some of the access to &#8220;Advanced Search&#8221; is debatable for webmasters given it can lead to database searches of some complexity, that &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/date-range-reporting-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[2850,301,2851,429,2853,2852,932,997,2141,1054,1110,1186,1319,1345],"class_list":["post-43873","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-advanced-search","tag-date","tag-date-range","tag-file_get_contents","tag-nsw","tag-nsw-government","tag-php","tag-programming","tag-range","tag-report","tag-search","tag-sql","tag-tutorial","tag-url"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/43873"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=43873"}],"version-history":[{"count":3,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/43873\/revisions"}],"predecessor-version":[{"id":57076,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/43873\/revisions\/57076"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=43873"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=43873"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=43873"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}