[Gambas-user] DataView Help

Benoit Minisini benoit.minisini at gambas-basic.org
Wed Jul 12 23:50:23 CEST 2023


Le 12/07/2023 à 15:59, Gianluigi a écrit :
> Il 12/07/23 10:17, Gianluigi ha scritto:
>> 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, 
>> $sLastSurname)
>> DataView1.Find("surname=&1 AND students_id=&2", $sLastSurname, i)
>>
>> Regards
>>
>> Gianluigi
> 
> Hi Benoit,
> 
> I tried to get the row from DataView_Data when the cell value is that of 
> the saved record.
> Unfortunately it returns zero.
> 
> I've run out of ideas and I don't think I'm the only one, yet if the 
> record sits in the correct row how is it possible not to get that darn 
> number?
> 
> Since my head is now broken, I await some nightly inspiration.
> 
> Sigh!
> 
> Regards
> 

In the last commit, calling DataSource.Save() on a new record 
automatically moves it to the newly created record.

After having called DataSource.Save(), you just have to read 
DataSource.Index to get the index of the newly created record.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list