<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Attempting to read a domain value and set it as a default option for a field. in .NET and the Esri JavaScript API Questions</title>
    <link>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/attempting-to-read-a-domain-value-and-set-it-as-a/m-p/809080#M41</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there! I am using VB.NET and Visual Studio 2017. I have three fields, MOTTLES, RCL, AND SEEPAGE, that all have domains with two values in them - absent and present. I want to read these values, and set fields that correspond to these categories as a default 'absent'. I've had some luck with setting a numerical default value, but am unsure how to refer to coded values. This is within my Public Sub New:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If IsNewRecord Then&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;Me.SAMPLE_ID = Constants.UserCollectionCount.sampleName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;If OBSERVATION_TYPE = enumTillTypes.Geochem Then&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A_BOUNDARY_UP = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I most recently created a property AllMottles to read through the values of the domain and check for a specific value:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dim temp As IReadOnlyList(Of CodedValue) = MyBase.GetAllCodeValues(Constants.COL_TILL_MOTTLES)&lt;BR /&gt; Dim returnValue As New List(Of CodedValue)(temp.Count)&lt;BR /&gt; Dim mottlescode As String&lt;BR /&gt; If OBSERVATION_TYPE = enumTillTypes.Geochem Then&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;For Each entry As CodedValue In temp&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;mottlescode = entry.Code.ToString&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;If mottlescode.StartsWith("A") Then&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;returnValue.Add(entry)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End If&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Else&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But again, am not sure how to refer to the codedvalue itself.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help would be great!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Mar 2019 14:41:04 GMT</pubDate>
    <dc:creator>MatthewWard</dc:creator>
    <dc:date>2019-03-28T14:41:04Z</dc:date>
    <item>
      <title>Attempting to read a domain value and set it as a default option for a field.</title>
      <link>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/attempting-to-read-a-domain-value-and-set-it-as-a/m-p/809080#M41</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there! I am using VB.NET and Visual Studio 2017. I have three fields, MOTTLES, RCL, AND SEEPAGE, that all have domains with two values in them - absent and present. I want to read these values, and set fields that correspond to these categories as a default 'absent'. I've had some luck with setting a numerical default value, but am unsure how to refer to coded values. This is within my Public Sub New:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If IsNewRecord Then&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;Me.SAMPLE_ID = Constants.UserCollectionCount.sampleName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;If OBSERVATION_TYPE = enumTillTypes.Geochem Then&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A_BOUNDARY_UP = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I most recently created a property AllMottles to read through the values of the domain and check for a specific value:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dim temp As IReadOnlyList(Of CodedValue) = MyBase.GetAllCodeValues(Constants.COL_TILL_MOTTLES)&lt;BR /&gt; Dim returnValue As New List(Of CodedValue)(temp.Count)&lt;BR /&gt; Dim mottlescode As String&lt;BR /&gt; If OBSERVATION_TYPE = enumTillTypes.Geochem Then&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;For Each entry As CodedValue In temp&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;mottlescode = entry.Code.ToString&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;If mottlescode.StartsWith("A") Then&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;returnValue.Add(entry)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End If&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Else&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But again, am not sure how to refer to the codedvalue itself.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help would be great!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2019 14:41:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/attempting-to-read-a-domain-value-and-set-it-as-a/m-p/809080#M41</guid>
      <dc:creator>MatthewWard</dc:creator>
      <dc:date>2019-03-28T14:41:04Z</dc:date>
    </item>
  </channel>
</rss>

