Currently my employees run the script below to find cancellations from our clients. In the Query Filter, the first 2 conditions are using LQO. The last condition does not. All fields referenced in the Filter are also indexed fields. I believe the last part of the Query goes thru all of the records because of the "OR" conditions. Unfortunately all of those "OR's" are necessary to run the Query correctly. What I am asking is there any other way I might be able to reference all of those conditions and have A5 use LQO for the entire Query Filter? If not, we will live with it but since there are approximately 82,000 records and growing daily, it would be great if we could cut the time it takes to run the query. It is especially slow over the network of course. I have commented out the Export portion while I have been working on this. Thanks for looking....
dim tbl as P
tstr1 = ui_get_text("Client Name","Please Enter Client")
if tstr1=""then
end
end if
user1=(tstr1)
dstr = ui_get_date("Date Received","Please Enter Date In")
if dstr=""then
end
end if
user2=ctod(dstr)
tbl=table.open("ameregl3")
query.description = ""
query.order = ""
query.filter = "AMEREGL3->ATTORNEY="+quote(user1)+".AND.AMEREGL3->DATE_COMP={"+dtoc(user2)+"}.AND.(AMEREGL3->CODE=\"adne\".OR.ameregl3->code=\"cd\".OR.ameregl3->code=\"can\".OR.ameregl3->code=\"c2\".OR.ameregl3->code=\"cnc\".OR.ameregl3->code=\"pb2\".OR.ameregl3->code=\"cnp\".OR.ameregl3->code=\"cnc2\".OR.ameregl3->code=\"cc2\".OR.ameregl3->code=\"ia\".OR.ameregl3->code=\"isp\".OR.ameregl3->code=\"isn\".OR.ameregl3->code=\"ita\".OR.ameregl3->code=\"nan\".OR.ameregl3->code=\"npa\".OR.ameregl3->code=\"nun\".OR.ameregl3->code=\"nsa\".OR.ameregl3->code=\"nss\".OR.ameregl3->code=\"non\".OR.ameregl3->code=\"ncz\".OR.ameregl3->code=\"pba\".OR.ameregl3->code=\"pv\".OR.ameregl3->code=\"sdne\".OR.ameregl3->code=\"ssw\".OR.ameregl3->code=\"cmra\")"
query.options = "I"
tbl.query_create()
'export.type = 4
'export.names = .F.
'export.file = "\\Docserver\inetpub\EXCEL PROGRAMS\CANCELLATIONS\Cancellations.xls"
'export.options = ""
'export.field_sep = ""
'export.record_sep = ""
'export.fields = 9
'export.field1 = "ameregl3->attorney"
'export.field2 = "ameregl3->Person"
'export.field3 = "ameregl3->ref___"
'export.field4 = "ameregl3->date_in"
'export.field5 = "ameregl3->address"
'export.field6 = "ameregl3->poe_address"
'export.field7 = "ameregl3->code"
'export.field8 = "ameregl3->job"
'export.field9 = "ameregl3->comments"
'tbl.export()
tbl = table.close()
END
dim tbl as P
tstr1 = ui_get_text("Client Name","Please Enter Client")
if tstr1=""then
end
end if
user1=(tstr1)
dstr = ui_get_date("Date Received","Please Enter Date In")
if dstr=""then
end
end if
user2=ctod(dstr)
tbl=table.open("ameregl3")
query.description = ""
query.order = ""
query.filter = "AMEREGL3->ATTORNEY="+quote(user1)+".AND.AMEREGL3->DATE_COMP={"+dtoc(user2)+"}.AND.(AMEREGL3->CODE=\"adne\".OR.ameregl3->code=\"cd\".OR.ameregl3->code=\"can\".OR.ameregl3->code=\"c2\".OR.ameregl3->code=\"cnc\".OR.ameregl3->code=\"pb2\".OR.ameregl3->code=\"cnp\".OR.ameregl3->code=\"cnc2\".OR.ameregl3->code=\"cc2\".OR.ameregl3->code=\"ia\".OR.ameregl3->code=\"isp\".OR.ameregl3->code=\"isn\".OR.ameregl3->code=\"ita\".OR.ameregl3->code=\"nan\".OR.ameregl3->code=\"npa\".OR.ameregl3->code=\"nun\".OR.ameregl3->code=\"nsa\".OR.ameregl3->code=\"nss\".OR.ameregl3->code=\"non\".OR.ameregl3->code=\"ncz\".OR.ameregl3->code=\"pba\".OR.ameregl3->code=\"pv\".OR.ameregl3->code=\"sdne\".OR.ameregl3->code=\"ssw\".OR.ameregl3->code=\"cmra\")"
query.options = "I"
tbl.query_create()
'export.type = 4
'export.names = .F.
'export.file = "\\Docserver\inetpub\EXCEL PROGRAMS\CANCELLATIONS\Cancellations.xls"
'export.options = ""
'export.field_sep = ""
'export.record_sep = ""
'export.fields = 9
'export.field1 = "ameregl3->attorney"
'export.field2 = "ameregl3->Person"
'export.field3 = "ameregl3->ref___"
'export.field4 = "ameregl3->date_in"
'export.field5 = "ameregl3->address"
'export.field6 = "ameregl3->poe_address"
'export.field7 = "ameregl3->code"
'export.field8 = "ameregl3->job"
'export.field9 = "ameregl3->comments"
'tbl.export()
tbl = table.close()
END
Comment