Cursor.FindSingleValue
Thomas Flemming
tf at ttqv.com
Tue Dec 29 10:29:51 CST 2009
Hi Ruslan,
> And you have cursor ordered by field 1.
> So binary search can be used on this field1.
> Binary search is FAST. Even for million record this is only 20 steps.
In c++, but also in vb.net?
Maybe you can give a short example, on how this could work.
Regards,
Tom
Ruslan Zasukhin schrieb:
> On 12/29/09 10:43 AM, "Thomas Flemming" <tf at ttqv.com> wrote:
>
>> Hi,
>>
>>> in. It looks like you do something like "select * from table" and than
>>> you are trying to apply another search criteria to the query result.
>> Yes, somehow....
>>
>> ok, I will give a description of the problem.
>> Its actually a problem of displaying the data.
>>
>> I'm using a grid to display the data, which has a virtual-display mode.
>> This means, the records are not loaded all at once in the grid, but only when
>> needed.
>>
>> First I create the cursor with "select * from table order by field1"
>> Second only the records, which are currently visible, are loaded into the
>> grid. The row-number of the grid is the cursor-position.
>> So if the grid needs to display lets say rows 10000-10020 then it goes easy
>> with cursor.position=10000 etc.
>>
>> This is very fast.
>>
>> The problem comes now, when I need the grid to scroll down to show a specific
>> record.
>> For example, in another form I did a query:
>> "select * from table where name="flemming"
>> This gives me one record.
>>
>> Now I want the grid to show this record, but I can only do this in scrolling
>> to this spcific grid-row, which is the cursor.position of the first query.
>>
>> The only solution I found until now is iterating throug the cursor, until I
>> found this record. Then I have the cursor.position and can jump in the grid to
>> that row.
>> But this is of course slow for a large amount of data (1 mio records).
>
> Hi Thomas,
>
> You know, during last years quite many developers did similar task.
>
> Actually some of them did e.g. FILTER, i.e. User type ONE MORE char into
> search field, and we need reduce records in the grid.
> Solution is - just to execute NEW QUERY.
> Valentina is so fast that is able in live mode do searches while user types.
> At least locally.
>
> Yes, I see, that your task is NOT filter...
> It is something different...
>
> And you have cursor ordered by field 1.
> So binary search can be used on this field1.
> Binary search is FAST. Even for million record this is only 20 steps.
>
>
>
>
--
/****************************************
** Dipl.-Ing. Thomas Flemming
** Software Development
**
** Touratech AG
** Auf dem Zimmermann 7-9
** D-78078 Niedereschach
**
** mail tf at ttqv.com
** fon +49 (0) 7728 9279-206
** fax +49 (0) 7728 9279-29
**
** http://www.ttqv.com
** http://www.touratech.de
**
** ... und immer dem Pfeil nach!
***************************************/
More information about the Valentina
mailing list