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.