I want to change our search as it is a bit hacky now. Currently it works like this:
- User enter a text in a textbox, for example Volvo and start searching.
- This search with SQL all posts containing Volvo.
- The result is a list with 2 columns, BoldID and DisplayValue.
- BoldID is just an unique number to identify the object in database.
- DisplayValue is what the user see in the list of results.
- Each row in the resultset is identified with a row number in users list. The first with 1, the second with 2 and so on.
- There is also a limitation to only show max 99 hits by intention by looping the query in code. It is not good to have a query that returns many hits as it no meaning to have more in the users hit list. The search should be more specific in that case.
The result list is displayed in a separate global window called rightpane. The hacky part is that if searching from a modal dialog then rightpane must be undocked from the main window to be able to pick a value with the mouse. We suspect this could be a reason that the application sometimes lock itself with the modal dialog behind the main window.
After change it should work like this:
The user enter text in a Combobox and start searching with SQL on demand like before. But the resultset is displayed in the combobox. So I only want to change the display if possible as there are a lot of old SQL queries that is in use and works fine now.
We use Delphi 2007, Interbase 2009 and components from DevExpress. Yesterday I tried to connect a customdatasource to a combobox, but I realize this was not implemented yet. See How to use a TcxCustomDataSource in a TcxExtLookupComboBox. I want to use a custom datasource to implement row number and max number of hits. Se 6 and 7 in the list above.
So now I see 2 options:
- Use a DB-aware combobox
- Use a textbox and attach a grid to it to display the resultset.
The combobox is simpler because it is a whole component, but I don't know how to implement feature 6 and 7 from the list above. The textbox + grid give more freedom but require more work.
I prefer the first option. The current problems is:
- I think Interbase SQL cannot restrict the amount of hits in the resultset. It must be done with code. How is this done with a DB-aware combobox ?
- How can I display row numbers in the resultset ?
Update 1: Requirement 7 is solved thanks to Marjan, thanks. As for 6 I think it is harder. Ideally I want it in SQL so I could extract an own column like Adding row no. But Interbase don't support that.