<?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 get field type description from a layer, using no hard-coded values in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/get-field-type-description-from-a-layer-using-no/m-p/1076229#M21053</link>
    <description>&lt;P&gt;I am currently building a 'select by attributes'-GUI, similar to the one in ArcGIS Pro, in our web solutions using Web Appbuilder 3.xx, however, I am getting issues with fetching the field description of the layer. Primarily, I want to know the type of the fieldName.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've looked through almost any source regarding fields and feature layers, but there seems to be nothing that can help me. I've even tried to create a new feature layer object, using the URL from the layerNode in LayerStructure, however, it cannot give me the field description, specifically the type. It gives me a null / undefined when I call "getField(fieldName)" on the layer object.&lt;/P&gt;&lt;P&gt;Another approach that I tried to follow was to use the layerNode's popup object's methods, yet I am receiving a different field description compared to the one from the service URL. It almost seems like it has a different signature or has a different description completely. I really don't want to hard-code any of my layers or services into the widget.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt; this&lt;/SPAN&gt;.&lt;SPAN&gt;layerStructure&lt;/SPAN&gt;.traversal((layerNode) =&amp;gt; {&lt;BR /&gt;    console.log(layerNode.id);&lt;BR /&gt;    console.log(layerNode.title);&lt;BR /&gt;&lt;SPAN&gt;    console.log(layerNode.layerNode._layerInfo.layerObject.url);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    let &lt;/SPAN&gt;popupInfo = layerNode.getPopupInfo()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    if &lt;/SPAN&gt;(popupInfo != &lt;SPAN&gt;null&lt;/SPAN&gt;) {&lt;BR /&gt;        &lt;SPAN&gt;for &lt;/SPAN&gt;(&lt;SPAN&gt;let &lt;/SPAN&gt;index = &lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;index &amp;lt; popupInfo.fieldInfos.&lt;SPAN&gt;length&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;index++) {&lt;BR /&gt;            &lt;SPAN&gt;let &lt;/SPAN&gt;fieldName = &lt;SPAN&gt;JSON&lt;/SPAN&gt;.&lt;SPAN&gt;stringify&lt;/SPAN&gt;(popupInfo.fieldInfos[index].fieldName)&lt;SPAN&gt;;&lt;BR /&gt;            console.log(fieldName);&lt;BR /&gt;            // This doesn't exist, but it would have been nice if we could get the type just as easy as this..&lt;BR /&gt;            // let fieldType = JSON.stringify(popupInfo.fieldInfos[index].fieldType); &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;            // console.log(fieldType);&lt;BR /&gt;&lt;/SPAN&gt;        }&lt;BR /&gt;    }&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;This will give the following result, if I were just to log the fieldInfos object:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="diaconori_0-1625657593475.png" style="width: 568px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/17854i76DDC3AC5C6BA8B7/image-dimensions/568x105?v=v2" width="568" height="105" role="button" title="diaconori_0-1625657593475.png" alt="diaconori_0-1625657593475.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Notice that it doesn't have a type, compared to when you look at one of the service url's field descriptions through a hyper-link in the browser:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="diaconori_1-1625657646525.png" style="width: 985px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/17855iBCC19DFA9FE14F49/image-dimensions/985x102?v=v2" width="985" height="102" role="button" title="diaconori_1-1625657646525.png" alt="diaconori_1-1625657646525.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any&amp;nbsp; advice on how to get the type of the field using layerNode or similar?&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jul 2021 11:43:36 GMT</pubDate>
    <dc:creator>diaconori</dc:creator>
    <dc:date>2021-07-07T11:43:36Z</dc:date>
    <item>
      <title>get field type description from a layer, using no hard-coded values</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/get-field-type-description-from-a-layer-using-no/m-p/1076229#M21053</link>
      <description>&lt;P&gt;I am currently building a 'select by attributes'-GUI, similar to the one in ArcGIS Pro, in our web solutions using Web Appbuilder 3.xx, however, I am getting issues with fetching the field description of the layer. Primarily, I want to know the type of the fieldName.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've looked through almost any source regarding fields and feature layers, but there seems to be nothing that can help me. I've even tried to create a new feature layer object, using the URL from the layerNode in LayerStructure, however, it cannot give me the field description, specifically the type. It gives me a null / undefined when I call "getField(fieldName)" on the layer object.&lt;/P&gt;&lt;P&gt;Another approach that I tried to follow was to use the layerNode's popup object's methods, yet I am receiving a different field description compared to the one from the service URL. It almost seems like it has a different signature or has a different description completely. I really don't want to hard-code any of my layers or services into the widget.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt; this&lt;/SPAN&gt;.&lt;SPAN&gt;layerStructure&lt;/SPAN&gt;.traversal((layerNode) =&amp;gt; {&lt;BR /&gt;    console.log(layerNode.id);&lt;BR /&gt;    console.log(layerNode.title);&lt;BR /&gt;&lt;SPAN&gt;    console.log(layerNode.layerNode._layerInfo.layerObject.url);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    let &lt;/SPAN&gt;popupInfo = layerNode.getPopupInfo()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    if &lt;/SPAN&gt;(popupInfo != &lt;SPAN&gt;null&lt;/SPAN&gt;) {&lt;BR /&gt;        &lt;SPAN&gt;for &lt;/SPAN&gt;(&lt;SPAN&gt;let &lt;/SPAN&gt;index = &lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;index &amp;lt; popupInfo.fieldInfos.&lt;SPAN&gt;length&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;index++) {&lt;BR /&gt;            &lt;SPAN&gt;let &lt;/SPAN&gt;fieldName = &lt;SPAN&gt;JSON&lt;/SPAN&gt;.&lt;SPAN&gt;stringify&lt;/SPAN&gt;(popupInfo.fieldInfos[index].fieldName)&lt;SPAN&gt;;&lt;BR /&gt;            console.log(fieldName);&lt;BR /&gt;            // This doesn't exist, but it would have been nice if we could get the type just as easy as this..&lt;BR /&gt;            // let fieldType = JSON.stringify(popupInfo.fieldInfos[index].fieldType); &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;            // console.log(fieldType);&lt;BR /&gt;&lt;/SPAN&gt;        }&lt;BR /&gt;    }&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;This will give the following result, if I were just to log the fieldInfos object:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="diaconori_0-1625657593475.png" style="width: 568px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/17854i76DDC3AC5C6BA8B7/image-dimensions/568x105?v=v2" width="568" height="105" role="button" title="diaconori_0-1625657593475.png" alt="diaconori_0-1625657593475.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Notice that it doesn't have a type, compared to when you look at one of the service url's field descriptions through a hyper-link in the browser:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="diaconori_1-1625657646525.png" style="width: 985px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/17855iBCC19DFA9FE14F49/image-dimensions/985x102?v=v2" width="985" height="102" role="button" title="diaconori_1-1625657646525.png" alt="diaconori_1-1625657646525.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any&amp;nbsp; advice on how to get the type of the field using layerNode or similar?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 11:43:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/get-field-type-description-from-a-layer-using-no/m-p/1076229#M21053</guid>
      <dc:creator>diaconori</dc:creator>
      <dc:date>2021-07-07T11:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: get field type description from a layer, using no hard-coded values</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/get-field-type-description-from-a-layer-using-no/m-p/1077191#M21064</link>
      <description>&lt;P&gt;Update - a step closer:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="diaconori_0-1625832902967.png" style="width: 727px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18082iD376A7EF53FF8295/image-dimensions/727x685?v=v2" width="727" height="685" role="button" title="diaconori_0-1625832902967.png" alt="diaconori_0-1625832902967.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;There's a field or attribute on the layerObject that shows all the information that I need from the rest service.&lt;BR /&gt;&lt;BR /&gt;Output in text (marked with blue):&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;_fields: Proxy &lt;BR /&gt;[[Handler]]: Object &lt;BR /&gt;[[Target]]: Array(13) &lt;BR /&gt;0: {name: "OBJECTID", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeOID&lt;/FONT&gt;", alias: "OBJECTID", length: undefined, editable: false, …} &lt;BR /&gt;1: {name: "VARME_TYPE", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeInteger&lt;/FONT&gt;", alias: "VARME_TYPE", length: undefined, editable: false, …} &lt;BR /&gt;2: {name: "ENERGI_DIS", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeString&lt;/FONT&gt;", alias: "ENERGI_DIS", length: 9, editable: false, …} &lt;BR /&gt;3: {name: "ENERGI_DI1", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeString&lt;/FONT&gt;", alias: "ENERGI_DI1", length: 80, editable: false, …} &lt;BR /&gt;4: {name: "ID1", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeDouble&lt;/FONT&gt;", alias: "ID1", length: undefined, editable: false, …} &lt;BR /&gt;5: {name: "AJOUR", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeString&lt;/FONT&gt;", alias: "AJOUR", length: 111, editable: false, …} &lt;BR /&gt;6: {name: "CREATED_USER", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeString&lt;/FONT&gt;", alias: "CREATED_USER", length: 255, editable: false, …} &lt;BR /&gt;7: {name: "CREATED_DATE", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeDate&lt;/FONT&gt;", alias: "CREATED_DATE", length: 8, editable: false, …} &lt;BR /&gt;8: {name: "LAST_EDITED_USER", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeString&lt;/FONT&gt;", alias: "LAST_EDITED_USER", length: 255, editable: false, …} &lt;BR /&gt;9: {name: "LAST_EDITED_DATE", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeDate&lt;/FONT&gt;", alias: "LAST_EDITED_DATE", length: 8, editable: false, …} &lt;BR /&gt;10: {name: "Shape__Area", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeDouble&lt;/FONT&gt;", alias: "SHAPE.AREA", length: undefined, editable: false, …} &lt;BR /&gt;11: {name: "Shape__Length", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeDouble&lt;/FONT&gt;", alias: "SHAPE.LEN", length: undefined, editable: false, …} &lt;BR /&gt;12: {name: "GLOBALID", type: "&lt;FONT color="#3366FF"&gt;esriFieldTypeGlobalID&lt;/FONT&gt;", alias: "GLOBALID", length: 38, editable: false, …} &lt;BR /&gt;length: 13&lt;BR /&gt;__proto__: Array(0)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Originated from this line:&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;console&lt;/SPAN&gt;.&lt;SPAN&gt;log&lt;/SPAN&gt;(layerNode._layerInfo.layerObject)&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;How do I get the access to the &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;type&lt;/STRONG&gt; &lt;/FONT&gt;of the&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;_fields&lt;/STRONG&gt;&lt;/U&gt; property when it is within a Proxy object?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 12:17:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/get-field-type-description-from-a-layer-using-no/m-p/1077191#M21064</guid>
      <dc:creator>diaconori</dc:creator>
      <dc:date>2021-07-09T12:17:04Z</dc:date>
    </item>
  </channel>
</rss>

