DOCUMENT:Q274011 22-OCT-2000 [foxpro] TITLE :BUG: SET("FILTER") Converts Dates to Current Date Format PRODUCT :Microsoft FoxPro PROD/VER::5.0,5.0a,6.0 OPER/SYS: KEYWORDS:kbvfp500 kbvfp500a kbvfp500aBUG kbvfp500aFIX kbvfp600 kbvfp600bug kbXBase KbDBFDBC kbGr ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual FoxPro for Windows, versions 5.0, 5.0a, 6.0 ------------------------------------------------------------------------------- SYMPTOMS ======== If you set a filter on a table involving a date field and then use the SET("FILTER") function to see the filter, the date is converted according to the current SET DATE setting. This is particularly likely to cause problems if SET STRICTDATE is set to 1 or 2 in Visual FoxPro version 6.0. This behavior also applies to the FILTER() function. RESOLUTION ========== The following code saves and restores the filter properly: *!* Save the current filter lcSetDate = SET("DATE") lcSetMark = SET("MARK") SET DATE TO YMD SET MARK TO "-" lcSetFilter = SET("FILTER") lcNewSetFilter = STRTRAN(lcSetFilter, "{", "{^") SET DATE TO &lcSetDate SET MARK TO "&lcSetMark" *!* Restore the old filter SET FILTER TO &lcNewSetFilter STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- To view the problem, run the following code in a .prg file: CREATE TABLE datetest (dField D) FOR i = 1 TO 10 INSERT INTO datetest VALUES ({^2000-09-28} + i) ENDfor SET FILTER TO dField = {^2000-10-04} *!* Displays the problem under VFP6 only *!* SET STRICTDATE TO 2 *!* lcFilter = SET("FILTER") *!* SET FILTER TO &lcFilter *!* Displays the problem under both VFP5 and 6 - *!* interprets date as April 10th lcSetDate = SET("DATE") SET DATE TO MDY lcFilter = SET("FILTER") SET DATE TO DMY SET FILTER TO &lcFilter SET DATE TO &lcSetDate Additional query words: ====================================================================== Keywords : kbvfp500 kbvfp500a kbvfp500aBUG kbvfp500aFIX kbvfp600 kbvfp600bug kbXBase KbDBFDBC kbGrpDSFox kbDSupport kbCodeSnippet Technology : kbVFPsearch kbAudDeveloper kbVFP500 kbVFP600 kbVFP500a Version : :5.0,5.0a,6.0 Issue type : kbbug Solution Type : kbpending ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2000.