[Gambas-user] DataView Help

Gianluigi gradobag at gradobag.it
Thu Jul 13 00:31:13 CEST 2023


Il 12/07/23 23:50, Benoit Minisini ha scritto:
> 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,
>
Hi Benoit,

Maybe I didn't understand but if in the last project(*) I do:

Public Sub btnSave_Click()

   DataSource1.Save
   $iCurrentIndex = DataSource1.Index
   Print $iCurrentIndex ' <--------------------------------------- Get -1 !

End

Regards
Gianluigi

(*) https://paste.c-net.org/ConfirmMarches



More information about the User mailing list