On 01/05/2013 04:18 PM, Carey Gagnon wrote:
Ok...most of my trouble was resolved with John's suggestion. so now I
need to now how to right both the Choices and the Keys from my
dropdownlist to two fields in the database:

Which suggestion?


Keys (CityID from the Cities table) are already correctly being written
to the CityID field of the Companies table.
How can I write the Choices (CityName from the Cities table) to the City
field of the Companies table.

In the CitiesBizObj:

     def getCities(self):
         crs = self.getTempCursor()
         crs.execute("select CityID, CityName from dbo.Cities order by
CityName")
         ds = crs.getDataSet()
         names = [rec["CityName"] for rec in ds]
         keys = [rec["CityID"] for rec in ds]
         names.insert(0, "-Select A City-")
         keys.insert(0, 0)
         return (names, keys)

In the frmCompanies-code.py file:

## *!* ## Dabo Code ID: dDropdownList-dPanel-222
def afterInit(self):
     bizCities = self.Form.getBizobj("dbo.Cities")
     bizCities.requery()
     names, pks = bizCities.getCities()
     self.Choices = names
     self.Keys = pks
     self.ValueMode = "Key"


Depends on how the rest of the code is set up. Just know when a selection is made the Choice part becomes the dDropdownList.StringValue. This then can be used to set the Value for the City field.

http://paul.dabodev.com/doc/api/dabodoc/dabo.ui.uiwx.dDropdownList.dDropdownList.html




Thanks
Carey


--
Adrian Klaver
[email protected]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to