Newbie question: Null DateTime Fields


Author
Message
Ben Kim
Ben Kim
StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Hello,

I am throwing together a proof-of-concept application using StrataFrame.  We have several fields in our SQL datatables that allow null's (in fact most of them).  

Say I have a birthdate field in a personmaster table.   If the value is null, the bo throws an exception when I navigate to the record.  I have tried setting the alternate value on null to several things such as System.DBNull and System.DBNull.Value etc.  However it will not compile.

How does everyone else handle null values in their BO's especially datetime type fields?

Thanks!

Ben, Emergitech

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
You will use a field customization to add NULL support.  You can find this in the Application Framework help:

Business Layer -> Business Object Mapper -> Customizing a Field

Ben Kim
Ben Kim
StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)
Group: Forum Members
Posts: 99, Visits: 253
OK I see that.  We are new to this .NET thing.  Do you have a code snippet you can post to show us how to handle specifically Null datetimes that are bound to DateTimePicker control?
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
Create a field customization on your date time field to "Return an Alternate Value" of #1/1/1800#.  Then rebuild your partial and run your application.  If you are using the SF DateTimePicker then by default the NULL dates will be "empty" until you assign a value.
Ben Kim
Ben Kim
StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Thank you.  Did as you said, now the datetimepicker control shows blank on Null fields!  Awesome.  But (there is always that huh?) I now have a new issue since doing this. I have defined a master->detail form.  The Birthdate field which I was having issues with is defined in the parent BO.   Now since added the #1/1/1800# code to the BO, the Save/Undo buttons enable themselves whenever I navigate to a table entry that has a blank birthdate!  Ideas???
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 don't think the two are related.  A BO field has no control of the editing state of a BO.  The MaintenanceFormToolstrip follows the EditingState of the business object.  I would look for other things that may have changed.

The editing state is controled off of the EditingState of the BO which is changed from the Add(), Edit(), Save(), and Undo() of a BO or form. 

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
Ben,

We fixed a bug the other day that was affecting the IsDirty of the BO which will effect the Save and Undo buttons when refreshed.  This has been fixed and will be posted in the next update.  If this is keeping you from moving forward then we can give you a temporary fix, but if you are just on eval mode then this may not be an issue and you can just get a fix on the next update.

Ben Kim
Ben Kim
StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Wonderful.  I can wait for the fix since I am just evaluating and creating a POC application.  I thought I was doing something wrong.  Glad to hear you have a fix for it.
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
Just so it makes a little sense....we enhanced the DateTimePicker in the last update which introduced the minor issue...as luck would have it, you ran into the obscure requirements for this to happen Smile  At any rate, you can get it in your next update and it will resolve itself.
Ben Kim
Ben Kim
StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Lucky me! BigGrin  On a lighter note, thank you for developing such a wonderful framework!   Did you guys ever give Clarion a peek?  It does a lot of what you are accomplishing with StrataFrame and more.  However, the company that develops the language has lagged behind in technology over the years and the company I work for has had enough...which is the reason why we are moving to .NET.

If you want a RDC/VNC/PCAnywhere demo of the product, please let me know.  I would be more than happy to show you the power of Clarion so you can replicate it <grin>.

Ben

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