Help: Strict Date and save/restore filters 
Author Message
 Help: Strict Date and save/restore filters

We've got SET STRICTDATE TO 2 in our application to try and weed out
any and all potential Y2K problems. I ran into an interesting
connundrum today:

USE MyFile
SET FILTER TO dDate > {^1997-01-01}

(later, in another procedure, we want to change the filter, but
restore it after we're done... y'know, 'black box')

cOldFilt = FILTER()
(do something)
SET FILTER TO &cOldFilt.

This will immediately generate an "ambiguous date" error, since
FILTER() is returning "dDate > {1/1/97}".

Any suggestions?

TIA,

Mark A. Nadig
/\/\/




Fri, 11 May 2001 03:00:00 GMT  
 Help: Strict Date and save/restore filters
With Stricdate set to 2 VFP does not like the {}
USE SET FILTER TO dDate > DATE(1997,01,01)



Quote:
>We've got SET STRICTDATE TO 2 in our application to try and weed out
>any and all potential Y2K problems. I ran into an interesting
>connundrum today:

>USE MyFile
>SET FILTER TO dDate > {^1997-01-01}

>(later, in another procedure, we want to change the filter, but
>restore it after we're done... y'know, 'black box')

>cOldFilt = FILTER()
>(do something)
>SET FILTER TO &cOldFilt.

>This will immediately generate an "ambiguous date" error, since
>FILTER() is returning "dDate > {1/1/97}".

>Any suggestions?

>TIA,

>Mark A. Nadig
>/\/\/





Tue, 15 May 2001 03:00:00 GMT  
 Help: Strict Date and save/restore filters

Quote:

>With Stricdate set to 2 VFP does not like the {}
>USE SET FILTER TO dDate > DATE(1997,01,01)

Hi
I can't see that
    create cursor dates (date d)
    insert into dates values (date())
    set strictdate to 2
    set filter to date > {^1998-01-01}
Not a whisper of a problem

-Anders



Tue, 15 May 2001 03:00:00 GMT  
 Help: Strict Date and save/restore filters
Anders,

Quote:
>I can't see that
>    create cursor dates (date d)
>    insert into dates values (date())
>    set strictdate to 2
>    set filter to date > {^1998-01-01}
>Not a whisper of a problem

Ok, I must not have been clear in my example. I guess the most concise
way to state my problem is: "the filter() function returns dates in an
ambiguous format, which makes it useless for saving/restoring a
filter".
So, try this after the above code:

cOldFilt = FILTER()
SET FILTER TO &cOldFilt. && error

The issue is there's no generic way to save/restore a filter. I
understand, in the above example, I could simply
SET FILTER TO date > DATE( 1997, 1, 1). However, I've got a number of
"black-box" functions where they need to clear the filter before they
do processing. So, they save off the current filter and try to
re-apply before exiting the function. The function has no idea (nor
cares) what the current filter is.

Hope this clears it up. Thanks for the reply.

Best,

Mark
/\/\/




Tue, 15 May 2001 03:00:00 GMT  
 Help: Strict Date and save/restore filters

Quote:
>With Stricdate set to 2 VFP does not like the {}
>USE SET FILTER TO dDate > DATE(1997,01,01)

VFP doesn't like {}s?

Please see my reply to Anders if you're interested in clarification of
my issue.

Best,

Mark
/\/\/




Tue, 15 May 2001 03:00:00 GMT  
 Help: Strict Date and save/restore filters
SET FILTER TO date > {^1998-01-01}
oldfilter = SET("FILTER")
oldfilter = STRTRAN(oldfilter, "{", "{^")
SET FILTER TO &oldfilter
-Anders
Quote:

>Anders,

>>I can't see that
>>    create cursor dates (date d)
>>    insert into dates values (date())
>>    set strictdate to 2
>>    set filter to date > {^1998-01-01}
>>Not a whisper of a problem

>Ok, I must not have been clear in my example. I guess the most concise
>way to state my problem is: "the filter() function returns dates in an
>ambiguous format, which makes it useless for saving/restoring a
>filter".
>So, try this after the above code:

>cOldFilt = FILTER()
>SET FILTER TO &cOldFilt. && error

>The issue is there's no generic way to save/restore a filter. I
>understand, in the above example, I could simply
>SET FILTER TO date > DATE( 1997, 1, 1). However, I've got a number of
>"black-box" functions where they need to clear the filter before they
>do processing. So, they save off the current filter and try to
>re-apply before exiting the function. The function has no idea (nor
>cares) what the current filter is.

>Hope this clears it up. Thanks for the reply.

>Best,

>Mark
>/\/\/





Tue, 15 May 2001 03:00:00 GMT  
 Help: Strict Date and save/restore filters
Anders,

Quote:
>SET FILTER TO date > {^1998-01-01}
>oldfilter = SET("FILTER")
>oldfilter = STRTRAN(oldfilter, "{", "{^")
>SET FILTER TO &oldfilter

On my machine (NT 4.0 SP4, VFP 6 SP1) - SET( "FILTER") is returning
{1/1/98} with the above example - even if I SET CENTURY ON...? Did you
actually try your code?

Mark

/\/\/




Fri, 18 May 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. strict date question

2. Strict Date and View

3. Strict Date Format

4. Dataenvironment Filter property and filtering dates

5. How to save and restore table layout?

6. Need to save/restore FoxPro environment.

7. SAVE WINDOWS, RESTORE WINDOWS commands

8. Save and restore properties

9. Saving and restoring printed reports ?

10. How to save/restore screen color?

11. Save and Restore REPROCESS setting

12. Save/Restore and object???

 

 
Powered by phpBB® Forum Software