Combo TopMostValue and Nulls


Author
Message
Aaron Young
Aaron Young
StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)
Group: StrataFrame Users
Posts: 277, Visits: 1.1K
Hi,

I have a combobox with a lookup list bound to an int field. For the int field, my BO returns 0 as an alternate for null and my TopMostValue is set to 0. I have read several posts on here which suggests that if I select the TopMostItem then it should write Null back to the database and not 0. In my case, it writes 0 back to the database.

My database can accepts nulls so there is no problem on that score. Given the other posts, should I be seeing Null or 0 written to the database?

Thanks in advance,

Aaron

Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
You should be seeing the 0, so it is working as designed. It will return whatever value you specify as the TopMostValue. Smile
Aaron Young
Aaron Young
StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)
Group: StrataFrame Users
Posts: 277, Visits: 1.1K
Thanks for the reply Dustin. Is it possibly to specify a null value for TopMostValue instead of 0? I tried Null but it throws an error.

Thanks.

Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Heh, I was afraid you would ask that w00t.  In short, no, the topmostitem isn't really designed to work with Null values.

If you have that need, you'll need to populate the combo manually, creating your own datasource for the combobox with a null top most item. Smile 

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I do this all the time (have a field that accepts NULL and is using a combo). First, you setup the BO to set/return an alternate value for NULL. Note there are four possibilities for handling NULLs at the BO level: don't allow them, use a nullable type, return an alternate value in the BO if the db has a NULL, and both return an alternate value if the db is NULL and set NULL in db if the BO contains the alternate value. You want that last one. Sounds like you may have done this and are using zero. A good choice if valid values are positive integers. Next, you setup you combo to have a top most value. The value itself is zero, as that actually means NULL. Setup the topmosttext to be either a space or some text indicating that no value is selected. When the user selects the top most value, the property in the BO gets a zero, which translates into a NULL when saved to the database. BigGrin
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Yup, Greg is on fire today BigGrin
Aaron Young
Aaron Young
StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)
Group: StrataFrame Users
Posts: 277, Visits: 1.1K
Yeah, Greg is on fire Smile

I had the wrong setting in the BO - I was just returning an alternate value rather than setting it too.

Thanks Greg

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Anytime. Glad you got it figured out! BigGrin
Aaron Young
Aaron Young
StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)
Group: StrataFrame Users
Posts: 277, Visits: 1.1K
That's just it Greg, I didn't figure it out - you did! Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search