Hi all,
I have Alpha 5 v3.01 and I'm having difficulty making a query. I'm using the following XBasic code:
'debug(1)
parent.commit()
tbl = table.open("LabTable")
DIM F1Val AS C
' Search is a global variable.
F1Val = "*"+ltrim(trim(search.value))+"*"
tbl = table.current()
query.description = "A_Query"
query.order = "NAME"
query.filter = "SMATCH_MEMO("OTHER_LOCATION",F1Val).OR.SMATCH_MEMO("DESCRIPTION",F1Val).OR.SMATCH(NAME,F1Val)"
query.options = "N"
indx = tbl.query_create()
switch = setChkQuery("LabForm", "A_Query", indx)
if switch = .T. then
displaybrws("LabBrowse")
end if
------------------------------------------------------------
function setChkQuery as L(frm as C, indexname as C, indx as P)
f = obj(":" + frm)
rec_count = indx.records_get()
if rec_count == 0 then
ui_msg_box("Error","No Matching Records Found",0)
f.show_all()
setchkquery = .F.
else
f.index_set(indexname)
setchkquery = .T.
end if
end function
------------------------------------------------------------
function displaybrws as L(brws as C)
b = obj(":" + brws)
if is_object(b) then
b.show()
b.activate()
b.restore()
else
:Browse.view(brws)
end if
end function
According to the debugger it is messing up at:
indx = tbl.query_create()
with the error "invalid key length". Does anybody know what this error means or how to make it go away?
Thanks a bunch!
Andrew Hastings
I have Alpha 5 v3.01 and I'm having difficulty making a query. I'm using the following XBasic code:
'debug(1)
parent.commit()
tbl = table.open("LabTable")
DIM F1Val AS C
' Search is a global variable.
F1Val = "*"+ltrim(trim(search.value))+"*"
tbl = table.current()
query.description = "A_Query"
query.order = "NAME"
query.filter = "SMATCH_MEMO("OTHER_LOCATION",F1Val).OR.SMATCH_MEMO("DESCRIPTION",F1Val).OR.SMATCH(NAME,F1Val)"
query.options = "N"
indx = tbl.query_create()
switch = setChkQuery("LabForm", "A_Query", indx)
if switch = .T. then
displaybrws("LabBrowse")
end if
------------------------------------------------------------
function setChkQuery as L(frm as C, indexname as C, indx as P)
f = obj(":" + frm)
rec_count = indx.records_get()
if rec_count == 0 then
ui_msg_box("Error","No Matching Records Found",0)
f.show_all()
setchkquery = .F.
else
f.index_set(indexname)
setchkquery = .T.
end if
end function
------------------------------------------------------------
function displaybrws as L(brws as C)
b = obj(":" + brws)
if is_object(b) then
b.show()
b.activate()
b.restore()
else
:Browse.view(brws)
end if
end function
According to the debugger it is messing up at:
indx = tbl.query_create()
with the error "invalid key length". Does anybody know what this error means or how to make it go away?
Thanks a bunch!
Andrew Hastings
Comment