Welcome to Macrobject Community Login | Register | Faq  

    Macrobject Community
  Macrobject Software Knowledge Management and Collaboration Platform
Search    
   

Unable to set fields to NULL when creating a new object
Started by wasuplee123 at 09-08-2008 6:45 PM. Topic has 1 replies.

Print Search « Previous Thread Next Thread »
  09-08-2008, 6:45 PM
wasuplee123 is not online. Last active: 9/9/2008 9:31:45 AM wasuplee123

Top 25 Posts
Joined on 06-04-2008
Posts 8
Unable to set fields to NULL when creating a new object
Reply Quote
When I try to create a new object like this:
MyObject = TMyObject.Create(OM);
MyObject.Date := Now;
MyObject._Subject.Value := Null;
MyObject.Save;
It sets the Subject field to a blank string, not NULL.
If I use this workaround, it does work:

MyObject = TMyObject.Create(OM);
MyObject.Date := Now;
MyObject.Save;

MyObject := TMyObject.GetByID(OM, MyObject.ID); // ID is an auto-increment field
MyObject._Subject.Value := Null;
MyObject.Save;

It seems to work fine whenever you set a field to NULL on an existing record in the database, but if you try to set it to NULL on a new object, it gets set to a zero value instead.
   Report 
  09-09-2008, 9:21 AM
Bill is not online. Last active: 12/18/2009 11:43:49 PM Bill

Top 10 Posts
Joined on 06-28-2008
Posts 15
Re: Unable to set fields to NULL when creating a new object
Reply Quote
We'll check this and come back to you.
   Report 
Post
Macrobject Comm... » Developing Tool... » DObject O/R Map... » Unable to set fields to NULL when creating a new object

Powered by Community Server, by Telligent Systems