BO Mapper - Custom Field Properties (NULL Value Option)


Author
Message
Tim Dol
Tim Dol
StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
In 1.6 I noticed two new 'NULL Value Options' in customer field properties (BO Mapper). I don't see these explained in the documentation. Can you explain how to use them?

1) Return Alternate on Null / Set Null on Alternate (reference type)

2) Return Alternate on Null / Set Null on Alternate (value type)

Replies
Peter Jones
Peter Jones
StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)StrataFrame VIP (2.1K reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi,

Having just gone down this path I can offer this insight - it enables you to propergate nulls into your database. In my case I have the alternate value of string.empty for nullable string fields. By using these new options if the form control for the column is 'blanked out' then Null is saved to the database rather than "".

Cheers, Peter

StrataFrame Team
S
StrataFrame Developer (16K reputation)StrataFrame Developer (16K reputation)StrataFrame Developer (16K reputation)StrataFrame Developer (16K reputation)StrataFrame Developer (16K reputation)StrataFrame Developer (16K reputation)StrataFrame Developer (16K reputation)StrataFrame Developer (16K reputation)StrataFrame Developer (16K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yep, Peter is right.  The "Return Alternate on NULL" option only returned an alternate value if there was a DBNull.Value in the database.  However, if you set the property back to your alternate value, that alternate value was placed in the DataTable (not a DBNull.Value value). 

With the "Return Alternate on Null / Set Null on Alternate" options, it works the same as the above with a Get (the alternate is returned in the case of the DBNull.Value in the DataTable); however, the Set now tests the incoming value and if it equals the alternate value, DBNull.Value is copied into the DataTable.

The difference between the (reference type) and (value type) options really only affects VB.  When you specify the value type option, the = operator is used to compare the alternate value to the incoming value for the Set; with the reference type option, the "Is" operator is used to compare the alternate value to the incoming value.  With C#, both values do the same thing... since the "is" keyword is not a comparison operator like it is in VB; in C#, the "==" operator is used for both.  So, generally, you're going to want to use the (value type) option.  Only in a few cases in VB are you actually going to want to use the "Is" operator to compare your alternate to the value.

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