{"id":281,"date":"2004-08-09T02:38:42","date_gmt":"2004-08-08T18:38:42","guid":{"rendered":"http:\/\/foxpro.ntsl119.com\/scr\/?p=281"},"modified":"2007-11-02T14:03:08","modified_gmt":"2007-11-02T06:03:08","slug":"some-old-school-ic-filterin-code","status":"publish","type":"post","link":"https:\/\/foxpro.ntsl119.com\/scr\/archives\/281","title":{"rendered":"Some old-school-ic filterin&#8217; code"},"content":{"rendered":"<p>Early dawn-worm-code snippet:<\/p>\n<pre><font color=\"#0000FF\" size=\"2\" face=\"Tahoma, Verdana, sans-serif\">if<\/font><font size=\"2\" face=\"Tahoma, Verdana, sans-serif\"> .chkMonth.<\/font><font color=\"#0000FF\">value<\/font> != 0 .and. !<font color=\"#0000FF\">isblank<\/font>(.cmbMonth.<font color=\"#0000FF\">value<\/font>)<br \/>\r\n     cFilterDate = <font color=\"#0000FF\">upper<\/font>(<font color=\"#0000FF\">alltrim<\/font>(.cmbMonth.<font color=\"#0000FF\">value<\/font>))<br \/>\r\n     cFilterYear = \"(<font color=\"#0000FF\">year<\/font>(DATAAMPM.DATE) == <font color=\"#0000FF\">year<\/font>(<font color=\"#0000FF\">date<\/font>()))\"<br \/>\r\n     cFilter = \"(<font color=\"#0000FF\">upper<\/font>(<font color=\"#0000FF\">alltrim<\/font>(<font color=\"#0000FF\">cmonth<\/font>(DATAAMPM.DATE))) == cFilterDate)\"<br \/>\r\n     cFilter = cFilter + \" .and. \" + cFilterYear<br \/>\r\n     <font color=\"#006633\">**' cFileName = cFilterDate + alltrim(str(year(date())))<\/font><br \/>\r\n           <br \/>\r\n     dDate = cFilterDate + <font color=\"#0000FF\">alltrim<\/font>(<font color=\"#0000FF\">str<\/font>(<font color=\"#0000FF\">year<\/font>(<font color=\"#0000FF\">date<\/font>())))<br \/>\r\n     <font color=\"#0000FF\">report form<\/font> Report_AMPM <font color=\"#0000FF\">preview for<\/font> &amp;cFilter<br \/>\r\n<font color=\"#0000FF\">else<\/font><br \/>\r\n     cMess = 'Please specify the month first' + <font color=\"#0000FF\">chr<\/font>(13) + ;<br \/>\r\n                 'and check the Monthly Report filter'<br \/>\r\n     <font color=\"#0000FF\">messagebox<\/font>(cMess)<br \/>\r\n<font color=\"#0000FF\">endif<\/font><\/pre>\n<p>One&#8230; the above code is not &#8216;extremely optimized&#8217; and was done around <font face=\"Tahoma, Verdana, sans-serif\">2:16<\/font>AM. So get over it.<\/p>\n<p>Two&#8230; I&#8217;m just testing the preformatted tag and the colors. I recall someone blogging about a tool that &#8216;autocolorizes&#8217; code in blogs, but I just can&#8217;t remember the URL. At two in the morning I don&#8217;t want to be involve in any searches.<\/p>\n<p>Three it&#8217;s nice to know that the ELSE statement functions as &#8216;Everything Else&#8217; in most programming language. Foxpro included. <\/p>\n<p>In the above code, given lCondition_<font face=\"Tahoma, Verdana, sans-serif\">01<\/font> = .chkMonth.<font color=\"#0000FF\">value<\/font> != <font face=\"Tahoma, Verdana, sans-serif\">0<\/font> and lCondition_<font face=\"Tahoma, Verdana, sans-serif\">02<\/font> = !<font color=\"#0000FF\">isblank<\/font>(.cmbMonth.<font color=\"#0000FF\">value<\/font>), the ELSE clause would execute when:<\/p>\n<blockquote><p> <font face=\"Lucida Console, Courier New, Courier, mono\">A<\/font><font face=\"Lucida Console, Courier New, Courier, mono\">.   lCondition_01 == .F. and lCondition_02 == .F.<br \/>  B. lCondition_01 == .T. and lCondition_02 == .F.<br \/>  C. lCondition_01 == .F. and lCondition_02 == .T. <\/font><\/p><\/blockquote>\n<p>&#8230; and not just when A is satisfied. Which if this was done in one of our Math subjects (Automata-related) back in college will be the only basis for the output.<\/p>\n<p>The cFileName line has been weeded out in comments just for the sake of this post. It has been my practice to save and export some filtered queries (&#8216;native Foxpro filter&#8217; and SQL queries) generated by the program to an .xls file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Early dawn-worm-code snippet: if .chkMonth.value != 0 .and. !isblank(.cmbMonth.value) cFilterDate = upper(alltrim(.cmbMonth.value)) cFilterYear = &#8220;(year(DATAAMPM.DATE) == year(date()))&#8221; cFilter = &#8220;(upper(alltrim(cmonth(DATAAMPM.DATE))) == cFilterDate)&#8221; cFilter = cFilter + &#8221; .and. &#8221; + cFilterYear **&#8217; cFileName = cFilterDate + alltrim(str(year(date()))) dDate = cFilterDate + alltrim(str(year(date()))) report form Report_AMPM preview for &amp;cFilter else cMess = &#8216;Please specify the month [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,10],"tags":[],"class_list":["post-281","post","type-post","status-publish","format-standard","hentry","category-visual-foxpro","category-workblog"],"_links":{"self":[{"href":"https:\/\/foxpro.ntsl119.com\/scr\/wp-json\/wp\/v2\/posts\/281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/foxpro.ntsl119.com\/scr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/foxpro.ntsl119.com\/scr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/foxpro.ntsl119.com\/scr\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/foxpro.ntsl119.com\/scr\/wp-json\/wp\/v2\/comments?post=281"}],"version-history":[{"count":0,"href":"https:\/\/foxpro.ntsl119.com\/scr\/wp-json\/wp\/v2\/posts\/281\/revisions"}],"wp:attachment":[{"href":"https:\/\/foxpro.ntsl119.com\/scr\/wp-json\/wp\/v2\/media?parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/foxpro.ntsl119.com\/scr\/wp-json\/wp\/v2\/categories?post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/foxpro.ntsl119.com\/scr\/wp-json\/wp\/v2\/tags?post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}