setSelectedIndex from a SQL query.

Hi all

I have a tabpanel with lines - thousands in some cases. I would like to be able to go to an individual line by typing its id into the header of the tabpanel and have an onaction on it. I don’t want to change the foundset, but just set the selected index on the basis of the sql query.

I have got as far as this but can’t work it out. Would be grateful for any pointers on how to match up a dataset with a foundset…

var sql_query = "SELECT * FROM line_items WHERE line_itemsid = ?"
	var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), sql_query , [forms.line_items_complex_master.selected_line_id],1)
	forms.line_items_complex_master.foundset.setSelectedIndex(dataset.rowIndex)

Thanks

Bevil

that code will not really work in a multi user environment, except if you know 100% sure that the data that you query for will not change… (so the foundset and dataset are always in sync)

I think the only thing to really know it for sure that you have the right index is to loop through the foundset and compare the field yourself. (if the foundset is sorted on that field it could also be very fast)