﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Using Nullable in BO</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 09:28:29 GMT</lastBuildDate><ttl>20</ttl><item><title>Using Nullable in BO</title><link>http://forum.strataframe.net/FindPost724.aspx</link><description>Hello All!&lt;P&gt;I am setting up some fields in the mapper to Use Nullable Generic. This setting works ok if the field is a numeric type, but if the field is varchar, the code the mapper generates is causing the build to fail. Here is the code for the field:&lt;/P&gt;&lt;FONT size=2&gt;&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;''' &amp;lt;summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;''' Test&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;''' &amp;lt;/summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;''' &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;Browsable(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;False&lt;/FONT&gt;&lt;FONT size=2&gt;), _&lt;BR&gt;BusinessFieldDisplayInEditor(), _&lt;BR&gt;Description(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"Test"&lt;/FONT&gt;&lt;FONT size=2&gt;), _&lt;BR&gt;DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)&amp;gt; _&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Property&lt;/FONT&gt;&lt;FONT size=2&gt; [Test]() &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; Nullable(&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #dddd55" color=#0000ff size=2&gt;Of&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT style="BACKGROUND-COLOR: #dddd55"&gt; System.String&lt;/FONT&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; Get&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim&lt;/FONT&gt;&lt;FONT size=2&gt; loValue &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Object&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; loValue = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.CurrentRow.Item(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"Test"&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; loValue &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Is&lt;/FONT&gt;&lt;FONT size=2&gt; DBNull.Value &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;CType&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Nothing&lt;/FONT&gt;&lt;FONT size=2&gt;, Nullable(&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #dddd55" color=#0000ff size=2&gt;Of&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT style="BACKGROUND-COLOR: #dddd55"&gt; System.String&lt;/FONT&gt;))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;CType&lt;/FONT&gt;&lt;FONT size=2&gt;(loValue, Nullable(&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #dddd55" color=#0000ff size=2&gt;Of&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT style="BACKGROUND-COLOR: #dddd55"&gt; System.String&lt;/FONT&gt;))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Get&lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Set&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; value &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; Nullable(&lt;/FONT&gt;&lt;FONT style="BACKGROUND-COLOR: #dddd55" color=#0000ff size=2&gt;Of&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT style="BACKGROUND-COLOR: #dddd55"&gt; System.String&lt;/FONT&gt;))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; value.HasValue &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.CurrentRow.Item(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"Test"&lt;/FONT&gt;&lt;FONT size=2&gt;) = value.Value&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.CurrentRow.Item(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"Test"&lt;/FONT&gt;&lt;FONT size=2&gt;) = DBNull.Value&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Set&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Property&lt;/FONT&gt;&lt;/P&gt;&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;FONT color=#111111 size=2&gt;The hilighted code is giving the error: &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#111111&gt;Error&amp;nbsp;1&amp;nbsp;Type argument 'String' does not satisfy the 'Structure' constraint for type parameter 'T'&amp;nbsp;...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#111111&gt;Anyone know why this is? Thanks!&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Sat, 25 Mar 2006 11:26:22 GMT</pubDate><dc:creator>Kevin Lingofelter</dc:creator></item><item><title>RE: Using Nullable in BO</title><link>http://forum.strataframe.net/FindPost735.aspx</link><description>Really the same concept of any other type of generic...saving time when applicable without having to explicitly define a specific class or value while remaining strong-typed.&amp;nbsp; That is why they are dubbed "generics"...the same class can be used interchangably for different value types.&amp;nbsp;</description><pubDate>Sat, 25 Mar 2006 11:26:22 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Using Nullable in BO</title><link>http://forum.strataframe.net/FindPost731.aspx</link><description>Sounds good. What's the advantage of using the nullable generic type then?</description><pubDate>Fri, 24 Mar 2006 18:18:34 GMT</pubDate><dc:creator>Kevin Lingofelter</dc:creator></item><item><title>RE: Using Nullable in BO</title><link>http://forum.strataframe.net/FindPost727.aspx</link><description>Kevin,&lt;P&gt;Only structure data types support a generic nullable, and a string is not a structure data type.&amp;nbsp; To determine what does and does not support a nullable generic, you can reference the object browse and look at the inheritance.&amp;nbsp; Anything that inherits from a System.ValueType &lt;U&gt;can&lt;/U&gt; be used with a nullable generic.&amp;nbsp; Here is the rule of thumb, if Nothing or NULL can be assigned to it, it &lt;U&gt;does not&lt;/U&gt; support a nullable generic.&lt;P&gt;When nullable generic is not supported, use Return Alternate on NULL option for the field and specify the exact text below that should be returned.&amp;nbsp; For example, if you want to return an empty string, enter the following value: ""</description><pubDate>Fri, 24 Mar 2006 16:19:25 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Using Nullable in BO</title><link>http://forum.strataframe.net/FindPost726.aspx</link><description>Error in above post...&lt;/P&gt;&lt;P&gt;String are reference types so you &lt;STRONG&gt;can not &lt;/STRONG&gt;assign them as nullable</description><pubDate>Fri, 24 Mar 2006 15:02:42 GMT</pubDate><dc:creator>Robert Linton</dc:creator></item><item><title>RE: Using Nullable in BO</title><link>http://forum.strataframe.net/FindPost725.aspx</link><description>&lt;FONT color=#111111&gt;Hi Kevin,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111&gt;Any value type, including struct can be nullable: &lt;STRONG&gt;Except reference types&lt;/STRONG&gt;.&amp;nbsp;Strings are reference types so you can configure your BO string types as nullable.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111&gt;I'm new to SF...so this may not be entirely correct, but I've been using the "replace..." option and returning a " " instead.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111&gt;Hope that helps,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#111111&gt;Rob&lt;/FONT&gt;</description><pubDate>Fri, 24 Mar 2006 15:01:04 GMT</pubDate><dc:creator>Robert Linton</dc:creator></item></channel></rss>