<?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 Experience Builder Dev Update Web Scene Layer Data With Button in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-dev-update-web-scene-layer-data/m-p/1582347#M17238</link>
    <description>&lt;P&gt;I Have a experience builder app that has an add data widget a map and a custom widget. The custom widget needs a button on it that will update the attributes of graphics that are being loaded from an add data widget. The way i have it set up right now is with a JimuMapView. I extract all the features from the map and have a state the tracks which feature I Have selected. I then need to add a field to these features, for example isRemoved. I can't seem to figure out how to add this field and change it dynamically in the tsx for the widget.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;const handleRemove = () =&amp;gt; {
    if (currentFeatureSelected &amp;amp;&amp;amp; mapView) {
      setRemovedFeatures([...removedFeatures, currentFeatureSelected])
      const updatedDataPoints = allDataPoints.filter((_, index) =&amp;gt; index !== currentIndex)
      setAllDataPoints(updatedDataPoints)
      setCurrentIndex((prevIndex) =&amp;gt; (prevIndex &amp;gt; 0 ? prevIndex - 1 : 0))
    }
  }

const handleLayerChange = async () =&amp;gt; {
    console.log('Handling layer change', mapView)
    const allLayers = mapView.map.allLayers
    const dpoints = []

    const promises = allLayers.map((layer) =&amp;gt; {
      if (layer.type === 'scene') {
        const sceneLayer = layer
        return (sceneLayer as __esri.SceneLayer).queryFeatures().then((result) =&amp;gt; {
          console.log('Result', result)

          dpoints.push(...result.features)
        })
      }
      return Promise.resolve()
    })

    try {
      await Promise.all(promises)
      setAllDataPoints(dpoints)
      setAllDataPointsLoaded(true)
      setCurrentIndex(0)
      // console.log('All queryFeatures promises have been fulfilled')
    } catch (error) {
      console.error('Error handling layer change:', error)
    }
  }

const handleActiveMapViewsChange = (jimuMapView) =&amp;gt; {
    if (jimuMapView) {
      console.log('JimuMapView', jimuMapView.whenJimuLayerViewLoaded(() =&amp;gt; {
        console.log('LayerView loaded', jimuMapView.jimuLayerViews)
      }))
      setRealMapView(jimuMapView)
      // setMapDatasourceId(jimuMapView.dataSourceId)
      setMapView(jimuMapView.view)
    }
  }

 return (
    &amp;lt;div className="widget-starter jimu-widget"&amp;gt;
      &amp;lt;JimuMapViewComponent useMapWidgetId={props.useMapWidgetIds?.[0]} onActiveViewChange={handleActiveMapViewsChange} /&amp;gt;
      &amp;lt;div style={{ display: 'flex', flexDirection: 'column', gap: '10px', height: '100%', padding: '10px' }}&amp;gt;
        &amp;lt;div style={{ flex: '1', width: '100%' }}&amp;gt;
          &amp;lt;h4&amp;gt;&amp;lt;b&amp;gt;Current Selected Feature&amp;lt;/b&amp;gt; &amp;lt;br /&amp;gt; Class: {currentFeatureSelected &amp;amp;&amp;amp; currentFeatureSelected.attributes.class}&amp;lt;/h4&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div style={{ display: 'flex', width: '100%', gap: '10px' }}&amp;gt;

          &amp;lt;Button size='lg' style={{ borderRadius: '8px', flex: 1 }} type='danger' variant='contained' onClick={handleRemove}&amp;gt;
            Remove
          &amp;lt;/Button&amp;gt;
          &amp;lt;Button size='lg' style={{ borderRadius: '8px', flex: 1 }} type='primary' variant='contained' onClick={handleKeep}&amp;gt;
            Keep
          &amp;lt;/Button&amp;gt;

        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Feb 2025 17:20:56 GMT</pubDate>
    <dc:creator>ahuey</dc:creator>
    <dc:date>2025-02-05T17:20:56Z</dc:date>
    <item>
      <title>Experience Builder Dev Update Web Scene Layer Data With Button</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-dev-update-web-scene-layer-data/m-p/1582347#M17238</link>
      <description>&lt;P&gt;I Have a experience builder app that has an add data widget a map and a custom widget. The custom widget needs a button on it that will update the attributes of graphics that are being loaded from an add data widget. The way i have it set up right now is with a JimuMapView. I extract all the features from the map and have a state the tracks which feature I Have selected. I then need to add a field to these features, for example isRemoved. I can't seem to figure out how to add this field and change it dynamically in the tsx for the widget.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;const handleRemove = () =&amp;gt; {
    if (currentFeatureSelected &amp;amp;&amp;amp; mapView) {
      setRemovedFeatures([...removedFeatures, currentFeatureSelected])
      const updatedDataPoints = allDataPoints.filter((_, index) =&amp;gt; index !== currentIndex)
      setAllDataPoints(updatedDataPoints)
      setCurrentIndex((prevIndex) =&amp;gt; (prevIndex &amp;gt; 0 ? prevIndex - 1 : 0))
    }
  }

const handleLayerChange = async () =&amp;gt; {
    console.log('Handling layer change', mapView)
    const allLayers = mapView.map.allLayers
    const dpoints = []

    const promises = allLayers.map((layer) =&amp;gt; {
      if (layer.type === 'scene') {
        const sceneLayer = layer
        return (sceneLayer as __esri.SceneLayer).queryFeatures().then((result) =&amp;gt; {
          console.log('Result', result)

          dpoints.push(...result.features)
        })
      }
      return Promise.resolve()
    })

    try {
      await Promise.all(promises)
      setAllDataPoints(dpoints)
      setAllDataPointsLoaded(true)
      setCurrentIndex(0)
      // console.log('All queryFeatures promises have been fulfilled')
    } catch (error) {
      console.error('Error handling layer change:', error)
    }
  }

const handleActiveMapViewsChange = (jimuMapView) =&amp;gt; {
    if (jimuMapView) {
      console.log('JimuMapView', jimuMapView.whenJimuLayerViewLoaded(() =&amp;gt; {
        console.log('LayerView loaded', jimuMapView.jimuLayerViews)
      }))
      setRealMapView(jimuMapView)
      // setMapDatasourceId(jimuMapView.dataSourceId)
      setMapView(jimuMapView.view)
    }
  }

 return (
    &amp;lt;div className="widget-starter jimu-widget"&amp;gt;
      &amp;lt;JimuMapViewComponent useMapWidgetId={props.useMapWidgetIds?.[0]} onActiveViewChange={handleActiveMapViewsChange} /&amp;gt;
      &amp;lt;div style={{ display: 'flex', flexDirection: 'column', gap: '10px', height: '100%', padding: '10px' }}&amp;gt;
        &amp;lt;div style={{ flex: '1', width: '100%' }}&amp;gt;
          &amp;lt;h4&amp;gt;&amp;lt;b&amp;gt;Current Selected Feature&amp;lt;/b&amp;gt; &amp;lt;br /&amp;gt; Class: {currentFeatureSelected &amp;amp;&amp;amp; currentFeatureSelected.attributes.class}&amp;lt;/h4&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div style={{ display: 'flex', width: '100%', gap: '10px' }}&amp;gt;

          &amp;lt;Button size='lg' style={{ borderRadius: '8px', flex: 1 }} type='danger' variant='contained' onClick={handleRemove}&amp;gt;
            Remove
          &amp;lt;/Button&amp;gt;
          &amp;lt;Button size='lg' style={{ borderRadius: '8px', flex: 1 }} type='primary' variant='contained' onClick={handleKeep}&amp;gt;
            Keep
          &amp;lt;/Button&amp;gt;

        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 17:20:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/experience-builder-dev-update-web-scene-layer-data/m-p/1582347#M17238</guid>
      <dc:creator>ahuey</dc:creator>
      <dc:date>2025-02-05T17:20:56Z</dc:date>
    </item>
  </channel>
</rss>

