Error in business object...


Author
Message
StarkMike
StarkMike
Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)
Group: Forum Members
Posts: 436, Visits: 944
I'm getting an error in my business object when I try to run my app. I can understand what the debugger is telling me is wrong, but what I'm not sure of is how to fix it. The problem is I have a date field that contans nulls... that is the field will only contain a date when it is applicable. Most other times it will be empty. I'm including a screenshot of the error.



Thanks
Attachments
DateTimeError.jpg (137 views, 110.00 KB)
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
Mike,

You need to return some type of alternate value when you have a field that will support NULL values, this way you can avoid this error.  You can use a nullable generic or just returned a specified value when the value is DBNull.  To do this you will need to do the following:

  1. Open up the BO Mapper and navigate to your business object.  
  2. Select the DeferredTo field and click "Customize."  This will bring up the Custom Field Properties.  
  3. Under NULL Value Support, select "Use Nullable Generic" and then click OK.  
  4. Rebuild your partial class by using the Context Menu on the one BO that you just modified or click the "Rebuild All" button.  
  5. Run your application and the error should be gone.

You could also return an alternate value by selecting the "Return Alternate On Null" and then setting the "Null Replacement" value to #01/01/1800#

FYI:  All StrataFrame controls will respect #01/01/1800# as a NULL value so you can clear out the contents of a DateTime field by setting the ClearOnNull property.  If you do not want to use 01/01/1800 as the null date, you can set it to whatever you like and then set the NullDateValue property on the DateTimePicker to the date you prefer to use a "null".

Hope this helps. Smile

StarkMike
StarkMike
Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Trent, thanks for the response. I figured this one out by myself but since I am new to StrataFrame I wanted an "Official" answer. Wink I ended up choosing "Use Nullable Generic" and it seems to work fine for now.
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
I'm glad that you found the answer.  But I understand that sometimes it's nice to have confirmation as well BigGrin
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