I wrote this script some time ago, but have just come across a problem. It works OK, does all that I want it too, BUT, after running the script the system ignores any changes in any field that I try to input. After restarting A5 things are OK again. It is called from a right-click-menu.
The Script: Asks for a Location, searches the "Operator" table and lists any operators that are at that location. a double-click on the list then loads the relevant values into the logfile table record.
''XBasic
dim global new_operator as c
dim global new_op_unique as c
dim global new_c1 as c
dim global new_c3 as c
dim global new_colour as c
reply=upper(ui_get_text("Base Search for Operator","Enter Location Name"))
if reply = "" then
goto done
end if
t=table.open("Operator")
t.index_primary_put("z_find_all")
query.order="Country+Base+Area+Operator"
query.filter="containsi(base,reply) .or. containsi(area,reply)"
query.description="Find All Oper"
q=t.query_create()
n=q.records_get()
select
case n > 0
if is_object("Operator Lookup")
:Operator Lookup.show()
:Operator Lookup.activate()
else
form.view("Operator Lookup","Dialog")
end if
:Operator Lookup.close()
case n = 0
ui_msg_box("Base Search","No Operators on File for "+UPPER(Reply)+ " Found.")
end select
q.drop()
t.close()
Operator.text = new_operator
Op_unique.text = new_op_unique
c1.text = new_c1
status.text = new_c3
colour.text = new_colour
done:
end
I guess that the code is in fact quite correct, just that I am possibly missing something to put A5 back where it was before the script was called???
TIA
The Script: Asks for a Location, searches the "Operator" table and lists any operators that are at that location. a double-click on the list then loads the relevant values into the logfile table record.
''XBasic
dim global new_operator as c
dim global new_op_unique as c
dim global new_c1 as c
dim global new_c3 as c
dim global new_colour as c
reply=upper(ui_get_text("Base Search for Operator","Enter Location Name"))
if reply = "" then
goto done
end if
t=table.open("Operator")
t.index_primary_put("z_find_all")
query.order="Country+Base+Area+Operator"
query.filter="containsi(base,reply) .or. containsi(area,reply)"
query.description="Find All Oper"
q=t.query_create()
n=q.records_get()
select
case n > 0
if is_object("Operator Lookup")
:Operator Lookup.show()
:Operator Lookup.activate()
else
form.view("Operator Lookup","Dialog")
end if
:Operator Lookup.close()
case n = 0
ui_msg_box("Base Search","No Operators on File for "+UPPER(Reply)+ " Found.")
end select
q.drop()
t.close()
Operator.text = new_operator
Op_unique.text = new_op_unique
c1.text = new_c1
status.text = new_c3
colour.text = new_colour
done:
end
I guess that the code is in fact quite correct, just that I am possibly missing something to put A5 back where it was before the script was called???
TIA
Comment