Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Xbase Fox > VFP 9: Filters ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 823 of 852
Post > Topic >>

VFP 9: Filters Implemented with SQL

by Gene Wirchenko <genew@[EMAIL PROTECTED] > Jan 3, 2008 at 05:45 PM

The client billing app that I maintain has many browses.  My boss
is used to the presentation, so I have stretched their use, probably
overstretched.  The latest is definitely kludgy, if not somewhat of a
travesty.

     My boss wants to be able to see which Work Function Codes (what
is done) exist in a given year that do not have a later version. (Work
Function Codes have a date that they are valid until (validtil).)  A
browse is better for our purposes than a cursor because it is
updatable to the base table.

     I have implemented a proof-of-concept kludge^Wtravesty^Wsomething
to do this.  Undoubtedly, there are better ways.  It is somewhat slow
to start up, but is generally fine after.

     MY QUESTION: Am I relying on any potentially undefined behaviour
to get what appear to be correct results?

     (cbs2.h defines some values used in the client billing system as
a whole.  The only one used in this program is "SQLSEL" which maps to
"select".)

********** Start of Included Program **********
* r477filt
* Check for Missing New WFCs by Filter
* Last Modification: 2008-01-03

   ? "*** Execution begins."
   ? program()

   close all
   clear all

   set talk off
   set exact on
   set ansi on
   set deleted on

   *

#include "cbs2.h"

   use cwkf exclusive

   index on upper(clcode+funccode+wccode)+dtos(validtil) tag r477filt
   index on clcode tag r477clc
   index on funccode tag r477wfc
   index on wccode tag r477wcc
   index on validtil tag r477vt

   use cwkf order tag r477filt
   set filter to livefilter()

   browse normal

   use in cwkf

   *

   close all
   clear all
   ? "*** Execution ends."
   return



procedure livefilter

   oldlow={^2007.01.01}
   oldhigh={^2007.12.31}

   infunccode=funccode
   inclcode=clcode
   inwccode=wccode
   invalidtil=validtil

   SQLSEL * from cwkf;
   where;
    funccode=infunccode and clcode=inclcode and wccode=inwccode and;
    validtil=;
     (;
     SQLSEL max(validtil) from cwkf;
     where;
      funccode=infunccode and clcode=inclcode and wccode=inwccode;
     );
    and validtil>=oldlow and validtil<=oldhigh;
   into cursor checker

   retval=.t.
   select checker
   goto top
   rowcount=reccount()
   ckvalidtil=validtil
   use in checker 

   return rowcount=1 and ckvalidtil=invalidtil

   endproc
********** End of Included Program **********

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
     I have preferences.
     You have biases.
     He/She has prejudices.
 




 6 Posts in Topic:
VFP 9: Filters Implemented with SQL
Gene Wirchenko <genew@  2008-01-03 17:45:59 
Re: VFP 9: Filters Implemented with SQL
Gene Wirchenko <genew@  2008-01-05 23:30:39 
Re: VFP 9: Filters Implemented with SQL
"Stefan Wuebbe"  2008-01-06 13:24:46 
Re: VFP 9: Filters Implemented with SQL
Gene Wirchenko <genew@  2008-01-06 17:56:44 
Re: VFP 9: Filters Implemented with SQL
"Stefan Wuebbe"  2008-01-15 10:35:07 
Re: VFP 9: Filters Implemented with SQL
Gene Wirchenko <genew@  2008-01-15 18:22:04 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 1:24:52 CDT 2008.