[Gambas-user] Using DataBrowser for a table which

Benoît Minisini gambas at ...1...
Thu Aug 23 15:36:31 CEST 2012


Le 23/08/2012 12:07, John Rose a écrit :
> Benoit,
>
> I've just asked kendek to create new Ubuntu .debs in his pre-release
> Gambas Launchpad Ubuntu ppa repo for revision #5070: I don't like to
> compile a new version of Gambas3 myself as it seems to conflict with the
> installed version from kendek's ppa repo. When he has done his ppa
> update, I'll change my app to use the BeforeSave event handler. How do I
> define the current country's id value in it? My guess is something like
> (but not exactly that):
> DataSourceCentre.country_id = CountryId ' variable containing the
>                                          ' foreign key value
>

You will receive the Result object in an argument named "Data". So:

Data["country_id"] = CountryId

or Data!country_id = CountryId

Just think that gb.db.form is entirely written in Gambas, so when he 
wrote a record to the database, it does something like that:

rResult = DB.Create(...) or DB.Edit(...)
' some stuff that fills rResult
Raise BeforeSave(rResult)
rResult.Update

> Should I still use DataBrowserCentre embedded in DataSourceCentre
> embedded in DataSourceCountry (i.e. do I need DataSourceCountry)?

No.


> Do I
> still need the 'country_id = CountryId' filters in DataSourceCentre & in
> DataSourceCountry?

It's independent. But I think so, as you want show only the 
DataSourceCentre of the current country, don't you?

-- 
Benoît Minisini




More information about the User mailing list