I have the following code on a multistate button that is supposed to filter the table. Options are letters "A" to "Z". It is on a form, based on a set, the parent table of the set is my "Cust" table.
Misbehaviors:
1. Click on "A", it overwrites the customer name to "A". (yesterday. anyway)
2. Click on "A", "A" flashes in the Last name field, but does not overwrite it, nothing else happens. Close the form, reopen it, it now shows only customers with "A*" last names. Better, but still no cigar.
Code:
''XBasic
'script for the multistate button app
'' Filter the table
''
topparent:tables:cust.filter_expression = "left(last,1) = '" + multistateBTN1.text + "'"
topparent:tables:cust.order_expression = "LAST"
topparent:tables:cust.query()
''
'' Get the table handle from the form
''
t = topparent:tables:cust.current()
''
'' Get the current record count
''
i = t.index_primary_get()
count = i.records_get()
''
'' If we found no records, then we put up a warning and show all records
''
if count = 0
ui_msg_box("Warning", "No records found. Showing all records")
topparent:tables:cust.filter_expression = ""
topparent:tables:cust.order_expression = "LAST"
topparent:tables:cust.query()
end if
Blame Dan - he put it in the code archive!
I am utilizing Dan's multistate button code, which works perfectly for him (do I have to pay Dan so it will work for me?)
Stephen Williams
Misbehaviors:
1. Click on "A", it overwrites the customer name to "A". (yesterday. anyway)
2. Click on "A", "A" flashes in the Last name field, but does not overwrite it, nothing else happens. Close the form, reopen it, it now shows only customers with "A*" last names. Better, but still no cigar.
Code:
''XBasic
'script for the multistate button app
'' Filter the table
''
topparent:tables:cust.filter_expression = "left(last,1) = '" + multistateBTN1.text + "'"
topparent:tables:cust.order_expression = "LAST"
topparent:tables:cust.query()
''
'' Get the table handle from the form
''
t = topparent:tables:cust.current()
''
'' Get the current record count
''
i = t.index_primary_get()
count = i.records_get()
''
'' If we found no records, then we put up a warning and show all records
''
if count = 0
ui_msg_box("Warning", "No records found. Showing all records")
topparent:tables:cust.filter_expression = ""
topparent:tables:cust.order_expression = "LAST"
topparent:tables:cust.query()
end if
Blame Dan - he put it in the code archive!
I am utilizing Dan's multistate button code, which works perfectly for him (do I have to pay Dan so it will work for me?)
Stephen Williams
Comment