So it works great stan as you knew it would I only had to change the way it seen the eof for the table not sure why your way didn't work but I also have added a query in the middle to check if there is a record with the state, since this is a WAS "Worked All States" code sniplet and I really like the way you used the built in states list never knew that existed but I have only scraped the surface over the years. So here is the code that I made changes for. This is great for others to reference and if I'm working on something down the road Alpha Message Board will always be here to look back..
Code:
tst = cstates("A|S"+crlf())
sts = words(tst,1,50,.T.,crlf())
'build a collection variable
dim states as U
states.initialize("1|2","1","2",sts)
dim shared st as c
dim shared tbl as P
dim rtbl as P
rtbl=table.open("record-match") 'only open the destination table once
rtbl.batch_begin() 'turn on batch processing
tbl=table.open("netlogger")
tbl.fetch_first()
while .not. eof("netlogger")
st=tbl.State
if st <> "" .and. states.exist(alltrim(st)) 'check to see if the tbl.state exists in the collection
'state was found as worked
'start table query
'dim tbl as P
dim qry as P
dim nrecs as N
'tbl = table.current()
query.description = "Time Sheet"
query.order = "State"
query.filter = "State = VAR->st"
query.options = ""
qry = rtbl.query_create()
nrecs = qry.records_get()
IF (nrecs <> 0) then
qry.drop()
'ui_msg_box("Null Query","There are no records in the Query" ,UI_INFORMATION_SYMBOL)
query.order = ""
query.filter = ""
goto skip
end if
'trying the fetch find key for writing 1st 50 states in log
rtbl.enter_begin()
rtbl.Call=tbl.Call
rtbl.Qso_date=tbl.Qso_date
rtbl.Time_on=tbl.Time_on
rtbl.Clubmemberid=tbl.Clubmemberid
rtbl.Comment=tbl.Comment
rtbl.Name=tbl.Name
rtbl.Band=tbl.Band
rtbl.Rst_send=tbl.Band
rtbl.Rst_send=tbl.Rst_send
rtbl.Rst_rcvd=tbl.Rst_rcvd
rtbl.Mode=tbl.Mode
rtbl.Freq=tbl.Freq
rtbl.Qth=tbl.Qth
rtbl.State=tbl.State
rtbl.Cnty=tbl.Cnty
rtbl.Dxcc=tbl.Dxcc
rtbl.Gridsq=tbl.Gridsq
rtbl.Pref_name=tbl.Pref_name
rtbl.Operator=tbl.Operator
rtbl.Qsl_via=tbl.Qsl_via
rtbl.Country=tbl.Country
rtbl.Address=tbl.Address
rtbl.Award_status=tbl.Award_status
rtbl.Award_net=tbl.Award_net
rtbl.Club=tbl.Club
rtbl.Callsign=tbl.Callsign
rtbl.enter_end()
end if
skip:
tbl.fetch_next()
end while
rtbl.batch_end()
rtbl.close()
tbl.close()
Bookmarks