* DBLTEST.PRG eliminate large numbers of multiple spaces with the least
* number of replace clauses and no _tally loop
clos data
set talk off
erase ("temp.dbf")
#define SPLEN 254
create table temp (spaces c(SPLEN))
for m.i=1 to SPLEN-2
append blank
repl spaces with "A"+space(m.i)+"B"
endfor...
Not only are there old programs that still run fine, there are old problems that newer software make so much more difficult that they wouldn't be worth doing any more.
SELECT-SQL does not select records with a scope nor does it use relations the way you do so the SET DELETED command is not expected to work with SELECT-SQL. I tried to defeat SET DELETED the way that Fox would with this code:
USE FILE && Some deleted records here
SET DELETED ON && no longer...
...DELETED() or RECNO() properly, particularly when GROUP BY is present. Try this code on any table to see what I mean:
SELECT RECNO() AS RNO,COUNT(*) as CT FROM ANYTABLE GROUP BY RNO
I get "348,1" 348 times. 348 is the record count of the random table I chose.
What may be happening is that...
It's working here.
clos data
erase ("test.dbf")
create table test (zip c(5))
zips='00000,11296,90000,95800,95814,95900,96001,99999'
do while len(zips)>0
if ","$zips then
zw=left(zips,at(',',zips)-1)
zips=substr(zips,at(',',zips)+1)
else
zw=zips
zips=""
endif
append...
...necessary. It's usually faster to do what looks like extra work.
>Added 3 junk fields to tblPhone
My original file is 500 character per record * 300,000 records for 150MB in random order. When I extract and sort the keys + postable phone numbers to a temporary file, it's 150,000 records *...
...file is almost always faster. It could only be slower because of specific conditions of phone.dbf that neither of us know. If phone.dbf is all of
* Well ordered on our posting key
* Has few fields other than those required for the post
* Has few empty phone numbers or other kinds of phone...
None of the provided solutions are fast or organized enough. Relations will handle all details at top speed if you use them right.
clos data
erase ("temp.dbf")
use phone
sort on zip,address to temp fields zip,address,phone for not empty(phone)
clos data
use temp alias source
index on...
>I thought that Left Alt+Enter interactively causes the screen switch, but does not set it to one mode or the other on a permanent basis for subsequent application launches.
Windows 9x, permanent.
Windows NT, temporary.
I avoid putting constants into the code like 10 since they are likely to change later. I'd like the code to adapt.
REPLACE ALL charfield WITH Padl(ALLTRIM(STR(numfield)), len(charfield), '0')
This also makes it obvious that 10 isn't some value picked out of thin air.
Is it possible to keep the record count of the two files exactly the same so there is a RECNO() one to one correspondance between files? If so then they are easy to link.
clos data
use table055
sele 0
use table250
set rela to recno() into table055
With this code, each time you move RECNO() in...
The above code may work but wouldn't be appropriate if the files are very large. Here is the same thing in high performance code that makes full use of the Fox relational database:
set talk on
CLOS DATA
USE MASTER
INDEX ON PHONE UNIQUE COMPACT TO TEMP
SELE 0
USE MAIL
SET RELA TO PHONE INTO...
Using ERASE CLT.CDX will generate an error when CLT.DBF is opened the next time. I find that DELETE TAG ALL accomplishes the same thing without any errors.
...of any DOS program gets a consistent clock.
set talk off
create cursor dummy ( num n(4), tim n(8) )
pa=0
retry=0
for i=1 to 9999
a=int(seconds()*1000)
* a<pa, Bad Values shows how often the timer goes below it's previous value on each run
* a<=pa ensures unique ascending values...
I read more and noticed you asked for the position of the first numeric character. The same CHRTs will do it.
?POS("0",CHRT(desc,"0123456789","0000000000"))
While CHRTing the characters away and checking the length isn't the best way to do it, it did remind me how I do these things.
Dashed SSN:
WHERE "000-00-0000"$CHRTRAN(desc,"0123456789","0000000000")
SSN surrounded by whitespace
WHERE " 000000000 "$"...
Is there a way you can QUIT Foxpro and restart it again with some assistance from a BAT file? Say during the program we create a FOX1.BAT with the command to be run then QUIT Foxpro. If FOX were being run from a BAT file like this one we would run with all available memory then we'd start Fox...
Even with a newer Foxpro or an older Excel, you can
COPY TO <DBFFile> TYPE FOXPLUS
TYPE FOXPLUS will produce a DBF file from your existing DBF file without the extra header information that is blocking compatibility.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.