[Gambas-user] DataView Help

Gianluigi gradobag at gradobag.it
Wed Jul 12 10:17:51 CEST 2023

Il 12/07/23 09:04, Gianluigi ha scritto:
> Il 12/07/23 01:14, T Lee Davidson ha scritto:
>> On 7/11/23 08:40, Gianluigi wrote:
>>> I still couldn't select the correct row though, I always end up 
>>> selecting the last one
>> It appears that DataView.Find assumes the sort order of the view is 
>> by `students_id`. But, it isn't always. In fact, when the application 
>> launches, the view is sorted by `surname` descending.
>> The last inserted record is last in the database table. So, 
>> DataView.Find sets the current row to the last record in the view 
>> even if it is not sorted by `students_id`.
>> It appears to me to be a bug. But, I don't know how DataView.Find 
>> could determine the sort order of whichever column.
> HI,
> Yes, and so does DataSource.Find which, the wiki states, "Fin the 
> first row matching the specified filter and return its index."
> Benoit is there any chance of getting the position, if I try to enter 
> in Find a second parameter that I get correctly from BeforeSave 
> ("students_id=&1 AND surname=&2, i, $sLastSurname"), I get an error of 
> Query failed: near "&": syntax error.
> Does the query only work on the key?
> Regards
> Gianluigi
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Sorry Benoit, Lee,

I had misspelled the query, but even with the correct queries nothing 
changes, you always get the last row of the grid.
Of course the error nessage does not appear....

$iCurrentIndex = DataSource1.Find("students_id=&1 AND surname=&2", i, 
DataView1.Find("surname=&1 AND students_id=&2", $sLastSurname, i)



More information about the User mailing list