The following script was copied from a sample database. It was modified and used in our current application. The patients table is the parent table for a 1 to many set:
''XBasic
'script for the multistate button on the Data Entry form in the Patients
'table
'' Filter the table
''
topparent:tables:PATIENTS.filter_expression = "left(NAME, 1) = '" + mulstbtn1.text + "'"
topparent:tables:PATIENTS.order_expression = "NAME"
topparent:tables:PATIENTS.query()
''
'' Get the table handle from the form
''
t = topparent:tables:PATIENTS.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:PATIENTS.filter_expression = ""
topparent:tables:PATIENTS.order_expression = "NAME"
topparent:tables:PATIENTS.query()
END IF
Is there a way to furthur modify the filter expression? As an example we may want the list to be all patients with beginning letter "A" AND discharge date field blank (meaning the patient is currently admitted to the hospital). I have made several attempts at this and cannot seem to get the syntax correct. The most common error I get is that the field type is wrong.
Any help would be appreciated.
Dave Jones
''XBasic
'script for the multistate button on the Data Entry form in the Patients
'table
'' Filter the table
''
topparent:tables:PATIENTS.filter_expression = "left(NAME, 1) = '" + mulstbtn1.text + "'"
topparent:tables:PATIENTS.order_expression = "NAME"
topparent:tables:PATIENTS.query()
''
'' Get the table handle from the form
''
t = topparent:tables:PATIENTS.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:PATIENTS.filter_expression = ""
topparent:tables:PATIENTS.order_expression = "NAME"
topparent:tables:PATIENTS.query()
END IF
Is there a way to furthur modify the filter expression? As an example we may want the list to be all patients with beginning letter "A" AND discharge date field blank (meaning the patient is currently admitted to the hospital). I have made several attempts at this and cannot seem to get the syntax correct. The most common error I get is that the field type is wrong.
Any help would be appreciated.
Dave Jones
Comment