Allow null value in business object


Author
Message
Wang Tong Yin
Wang Tong Yin
StrataFrame Novice (61 reputation)StrataFrame Novice (61 reputation)StrataFrame Novice (61 reputation)StrataFrame Novice (61 reputation)StrataFrame Novice (61 reputation)StrataFrame Novice (61 reputation)StrataFrame Novice (61 reputation)StrataFrame Novice (61 reputation)StrataFrame Novice (61 reputation)
Group: Forum Members
Posts: 25, Visits: 46
Some of the fields in my table allow null value. Especially for datetime and decimal field. I want the default value of the controls, which mapped to these fields is null string ("") during initialization of add new record screen. How can I customize the fields in business object mapper so that the default value can be null string?
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
When a new record it added, the business object automatically initializes the values within the new row to remove any DBNull.Value values.  To prevent this, and allow all of the fields within the new row to be NULL, set the AllowNullValuesOnNewRow property on the business object to True.

If you only want a few fields to have NULL values, then in the SetDefaultValues event handler, add this code:

Me.CurrentRow("fieldname") = DBNull.Value

Add that for each field you want to initialize as a null value, and you'll be good to go.

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