<?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 Re: feature.fields.name will not print field name in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/feature-fields-name-will-not-print-field-name/m-p/1038163#M14453</link>
    <description>&lt;P&gt;Ok I figured it out. This is what I came up with. It slightly different than I wanted to go and will get more complicated when committing to drop down in widget, but life as a programmer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;var featLyr = this.config.facilitiesURL;&lt;BR /&gt;var names = [];&lt;BR /&gt;var layerInfoRequest = esri.request({&lt;BR /&gt;url: featLyr,&lt;BR /&gt;content: { f: "json" },&lt;BR /&gt;handleAs: "json",&lt;BR /&gt;callbackParamName: "callback"&lt;BR /&gt;});&lt;BR /&gt;layerInfoRequest.then(function (response) {&lt;BR /&gt;var fieldInfos = array.map(response.fields, function (aField) {&lt;BR /&gt;names.push(aField.name);&lt;BR /&gt;return {&lt;BR /&gt;fieldName: aField.name&lt;BR /&gt;};&lt;BR /&gt;});&lt;BR /&gt;for (i = 0; i &amp;lt; fieldInfos.length; i++) {&lt;BR /&gt;console.log(fieldInfos[i]);&lt;BR /&gt;}&lt;BR /&gt;}, function (error) {&lt;BR /&gt;console.log("Error: ", error.message);&lt;BR /&gt;});&lt;/P&gt;</description>
    <pubDate>Thu, 18 Mar 2021 17:04:50 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-03-18T17:04:50Z</dc:date>
    <item>
      <title>feature.fields.name will not print field name</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/feature-fields-name-will-not-print-field-name/m-p/1037858#M14451</link>
      <description>&lt;P&gt;I am trying to setup a dropdown list of fields for a feature class. I am trying to use feature.fields.name but it keeps coming undefined, but it will tell me the amount of fields that are undefined. I can use Dojo.Json:&amp;nbsp;console.log(dojoJson.toJson(featLyr.fields)); and get all the information about the fields but I cannot get just the field names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone ever hear of this problem were the feature.fields will work but the feature.fields.name will not?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 22:29:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/feature-fields-name-will-not-print-field-name/m-p/1037858#M14451</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-17T22:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: feature.fields.name will not print field name</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/feature-fields-name-will-not-print-field-name/m-p/1038097#M14452</link>
      <description>&lt;P&gt;I guess this might be be considered important to consider in trying to answer..&lt;/P&gt;&lt;P&gt;//featLyr is the URL of feature layer, labelField is a variable that is assigned to a field name&amp;nbsp;&lt;/P&gt;&lt;P&gt;featLyr = new FeatureLayer(this.svcFacilities.value, {&lt;BR /&gt;id: "featLyr",&lt;BR /&gt;outFields: [labelField]&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;var names = [];&lt;BR /&gt;console.log("featLyr: " + featLyr);&lt;BR /&gt;featLyr.on("load", function () {&lt;BR /&gt;for (i = 0; i &amp;lt; featLyr.fields.length; i++) {&lt;/P&gt;&lt;P&gt;//This one works fine, gives every&amp;nbsp; detail about fields&lt;BR /&gt;console.log(dojoJson.toJson(featLyr.fields));&lt;/P&gt;&lt;P&gt;//This next line should just report the field names, but reports number of fields and undefined. If run with previous console it runs not only field information, but also every bit of information in table.&lt;/P&gt;&lt;P&gt;console.log(featLyr.fields.name);&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 15:00:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/feature-fields-name-will-not-print-field-name/m-p/1038097#M14452</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-18T15:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: feature.fields.name will not print field name</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/feature-fields-name-will-not-print-field-name/m-p/1038163#M14453</link>
      <description>&lt;P&gt;Ok I figured it out. This is what I came up with. It slightly different than I wanted to go and will get more complicated when committing to drop down in widget, but life as a programmer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;var featLyr = this.config.facilitiesURL;&lt;BR /&gt;var names = [];&lt;BR /&gt;var layerInfoRequest = esri.request({&lt;BR /&gt;url: featLyr,&lt;BR /&gt;content: { f: "json" },&lt;BR /&gt;handleAs: "json",&lt;BR /&gt;callbackParamName: "callback"&lt;BR /&gt;});&lt;BR /&gt;layerInfoRequest.then(function (response) {&lt;BR /&gt;var fieldInfos = array.map(response.fields, function (aField) {&lt;BR /&gt;names.push(aField.name);&lt;BR /&gt;return {&lt;BR /&gt;fieldName: aField.name&lt;BR /&gt;};&lt;BR /&gt;});&lt;BR /&gt;for (i = 0; i &amp;lt; fieldInfos.length; i++) {&lt;BR /&gt;console.log(fieldInfos[i]);&lt;BR /&gt;}&lt;BR /&gt;}, function (error) {&lt;BR /&gt;console.log("Error: ", error.message);&lt;BR /&gt;});&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 17:04:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/feature-fields-name-will-not-print-field-name/m-p/1038163#M14453</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-18T17:04:50Z</dc:date>
    </item>
  </channel>
</rss>

