setting high date and PFCMARK
Bruce Easton
bruce at stn.com
Thu Apr 9 10:51:08 PDT 2009
Bruce Easton wrote yet again:
>
> Bruce Easton wrote Thursday, April 09, 2009 1:10 PM:
>
> Jose Lerebours wrote Thursday, April 09, 2009 12:20 PM:
> >
> > Richard D. Williams wrote:
> > > Try this;
> > >
> > > If: dl ne ""
> > > Then: end
> > > If: q ne ""
> > > Then: goto start
> > > if:
> > > Then: cls
> > > If:
> > > Then: input fa(4,#,g) "From Client Number "
> > > If:
> > > Then: input fb(4,#,g) "From "<fa<"to number "
> > > If:
> > > Then: input ff(8,mdy/,g) "Enter 1st date"
> > > If:
> > > Then: input ll(8,mdy/,g) "From"<ff<"to what ending date"
> > > If: fa eq " " or fb eq " " or ff eq "" or ll eq ""
> > > Then: msgbox "No Report Created!";exit
> > > If:
> > > Then: input popup ("22","") q(1,yesno,g) "Is this correct?
> > (Y/N)";cls
> > > If: q ne "Y"
> > > Then: msgbox "No Report Created!";exit
> > > If:
> > > Then: lookup - k=ff i=h -ng
> > > *start*: If: 18 gt ll
> > > Then: goto endit
> > > If: 1 ge fa and 1 le fb
> > > Then: select
> > > If:
> > > Then: end
> > > *endit*: If:
> > > Then: dl(8,mdy/,g)="12/31/79"
> > > If:
> > > Then: lookup - k=dl i=h -nl
> > > If:
> > > Then: end
> > >
> >
> > The first two lines of code should keep the script from asking the
> > questions and performing the lookup more than once.
> >
> > I would make two changes
> >
> > (1) Add
> > if: not -
> > then: end
> >
> > right after the original lookup.
> >
> > (2) Additionally, I would not use a hard coded date to jump to
> > possible last date, simply add a couple of years to end-date
> >
> > then: dl(8,mdy/,g)=ll+"1095" 'Add 3 years to end date
> >
> > By adding the three years to end date, no matter what your
> PFCMARK is
> > set, it is less likely that your code will break (should it
> be ported
> > to a different environment or PFCMARK have an unexpected value).
> >
> > Regards,
> >
> >
> > Jose Lerebours
>
> I frequently surprised by systems where people enter dates
> way off into the future, either by accident, and in some
> cases, to use the date field as a marker of some kind.
>
> Therefore, regarding Jose's point #2, it might be safest to
> have your selection flow like so (when working w/eight- digit
> selection dates and using lookup-dash to speed rpt):
>
>
> Then: qq(2,*)=getenv("PFCMARK"); qs(2,.0)=qq
> If: qs eq "0" and qs ne qq and qq ne "00"
> Then: goto XXXX 'PFCMARK missing/invalid--abort lu-dash;
> read all recs
> If: dl eq ""
> Then: qr(2,rj0)=qs+"0"; qr=qr-"1"; dl(8,mdy/,g)="12/31/"{qr
> If:
> Then: 'continue here with lookup dash technique using 'dl'
> .....
>
> XXXX If: '(common selection tests without using lookup-dash)
>
> Bruce
>
> (augmented version :)) I didn't take into consideration as
> Jose pointed out that someone might set PFCMARK to some
> strange value - so I've improved the sample code above.
>
OK, maybe one last improvement :) - top line needs to
allow "0" or "00", I believe. (Although I've never tried
to see if PFCMARK=00 or PFCMARK=0 are valid settings.)
Bruce
Bruce Easton
STN, Inc.
More information about the Filepro-list
mailing list