On 12/30/2012 12:56 PM, Carey Gagnon wrote:
If I only have a 2 character string to work with, should the ValueMode =
"String" ?
I want to figure this out but can't wrap my head around it. No matter what
I do I end up with one of 2 errors:
ValueError: Trying to set dDropdownList1.Value (DataSource: 'dbo.Cities',
DataField: 'ProvinceState') to these invalid selections: [u'']
OR
ValueError: String must be present in the choices: ''
The problem lies here:
def getProvinceState(self):
crs = self.getTempCursor()
crs.execute("select ProvinceState from dbo.ProvinceState order
by ProvinceState")
ds = crs.getDataSet()
names = [rec["ProvinceState"] for rec in ds]
names.insert(0, "-Select A Province/State-")
return (names)
def afterInit(self):
bizProvinceState = self.Form.getBizobj("dbo.ProvinceState")
bizProvinceState.requery()
names = bizProvinceState.getProvinceState()
self.Choices = names
self.Keys = names
self.ValueMode = "Key"
Keys and Choices are as Ed pointed out a 1:1 mapping. You have accounted
for all the possibilities except for the default value returned by
self.new() which is "". If you want to continue using new() then you
need to account for the "" value.
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]