<?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: Custom Widget Output Datasource in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-output-datasource/m-p/1412478#M12202</link>
    <description>&lt;P&gt;This is great Jillian you should add this to the custom widgets group, can't wait to test this out&amp;nbsp;&lt;A href="https://community.esri.com/t5/experience-builder-custom-widgets/gh-p/eb-custom-widgets" target="_blank"&gt;https://community.esri.com/t5/experience-builder-custom-widgets/gh-p/eb-custom-widgets&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Apr 2024 19:01:52 GMT</pubDate>
    <dc:creator>WDominguez-Zarate</dc:creator>
    <dc:date>2024-04-19T19:01:52Z</dc:date>
    <item>
      <title>Custom Widget Output Datasource</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-output-datasource/m-p/1377336#M10639</link>
      <description>&lt;P&gt;I have inherited a custom widget that grabs a csv from a dynamic location, creates a JSAPI CSVLayer and adds it to the map. This is working without issue in ExB 1.13.&lt;/P&gt;&lt;P&gt;I need to integrate this layer with the attribute table widget.&lt;/P&gt;&lt;P&gt;I've seen a few &lt;A href="https://community.esri.com/t5/arcgis-experience-builder-questions/set-up-a-widget-output-data-source-without/m-p/1323795" target="_self"&gt;posts&lt;/A&gt; suggesting that the way to accomplish this is to create an output datasource for the widget in the settings page.&lt;/P&gt;&lt;P&gt;I've done this using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const outputDsJsons: DataSourceJson[] = [{
        id: `${props.id}-output`,
        type: DataSourceTypes.FeatureLayer,
        label: "Test Layer",
        originDataSources: [],
        schema: {
          idField: "objectid",
          fields: {
            objectid: {
              jimuName: "objectid",
              name: "objectid",
              alias: "OBJECTID",
              type: JimuFieldType.Number,
              esriType: EsriFieldType.OID
            },
            state: {
              jimuName: "Route",
              name: "Route", 
              alias: "Route",
              type: JimuFieldType.Number,
              esriType: EsriFieldType.Integer
            },
            clicks: {
              jimuName: "Bus",
              name: "Bus",
              alias: "Bus",
              type: JimuFieldType.Number,
              esriType: EsriFieldType.Integer
            }
          }
        },
        isDataInDataSourceInstance: true
      }]
    
      this.props.onSettingChange({
        id: props.id,
        useDataSources: [] 
      }, outputDsJsons);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can see this output in the settings page of other widgets. So, for example, I can add it as a "New sheet" to the Attribute Table widget and the configured schema looks correct.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JillianStanford_0-1706825296383.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93502i981B043E2F8C837B/image-size/large?v=v2&amp;amp;px=999" role="button" title="JillianStanford_0-1706825296383.png" alt="JillianStanford_0-1706825296383.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, I can't figure out how to access this datasource and update it's records at run time. I can get a reference to the DataSourceManager and see all of the other datasources in the app but my custom output datasource doesn't appear.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JillianStanford_1-1706825520596.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93503i1954054B9A6FB8DF/image-size/large?v=v2&amp;amp;px=999" role="button" title="JillianStanford_1-1706825520596.png" alt="JillianStanford_1-1706825520596.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm not sure what I'm missing or where to go from here.&lt;/P&gt;&lt;P&gt;Any insight is greatly appreciated.&lt;/P&gt;&lt;P&gt;Jill&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 22:18:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-output-datasource/m-p/1377336#M10639</guid>
      <dc:creator>JillianStanford</dc:creator>
      <dc:date>2024-02-01T22:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Widget Output Datasource</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-output-datasource/m-p/1381931#M10865</link>
      <description>&lt;P&gt;I finally got this working and am leaving my solution here in case it helps someone else.&lt;/P&gt;&lt;P&gt;I added the following to the constructor of the settings page of my custom widget.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const outputDsJsons: DataSourceJson[] = [{
        id: `${props.id}-output`,
        type: DataSourceTypes.FeatureLayer,
        label: "QlikView Layer",
        originDataSources: [],        
        schema: {
          idField: "__OBJECTID",          
          fields: {
            __OBJECTID: {
              jimuName: "__OBJECTID",
              name: "__OBJECTID",
              alias: "__OBJECTID",
              type: JimuFieldType.Number,
              esriType: EsriFieldType.OID
            },
            Route: {
              jimuName: "Route",
              name: "Route", 
              alias: "Route",
              type: JimuFieldType.Number,
              esriType: EsriFieldType.Integer
            },
            .....
          }
        },
        isDataInDataSourceInstance: true
      }]
    
      this.props.onSettingChange({
        id: this.props.id,
        useDataSources: [] 
      }, outputDsJsons);&lt;/LI-CODE&gt;&lt;P&gt;Then I added the output datasource as a new sheet in my attribute table widget.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JillianStanford_0-1707860972044.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94679iEE54B087307A5ACB/image-size/large?v=v2&amp;amp;px=999" role="button" title="JillianStanford_0-1707860972044.png" alt="JillianStanford_0-1707860972044.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In my widget source I used the following to populate the records:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const dataRecords = [];
        const dataSourceManager = DataSourceManager.getInstance();
        const outputDsId = this.props.outputDataSources[0]
        dataSourceManager.createDataSource(outputDsId).then(ods =&amp;gt; {
          csvLayer.queryFeatures().then((results) =&amp;gt; {
            results.features.forEach((f) =&amp;gt; {
              const rec = ods.buildRecord(f)
              dataRecords.push(rec);
            });

            ods.setSourceRecords(dataRecords)
            ods.setStatus(DataSourceStatus.Unloaded)
            ods.setCountStatus(DataSourceStatus.Unloaded)
          })
        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No idea if this is the proper way to do this. I found it incredibly frustrating trying to implement this with the available documentation. I managed to piece something together from samples and community posts.&lt;/P&gt;&lt;P&gt;Jill&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 21:57:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-output-datasource/m-p/1381931#M10865</guid>
      <dc:creator>JillianStanford</dc:creator>
      <dc:date>2024-02-13T21:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Widget Output Datasource</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-output-datasource/m-p/1412478#M12202</link>
      <description>&lt;P&gt;This is great Jillian you should add this to the custom widgets group, can't wait to test this out&amp;nbsp;&lt;A href="https://community.esri.com/t5/experience-builder-custom-widgets/gh-p/eb-custom-widgets" target="_blank"&gt;https://community.esri.com/t5/experience-builder-custom-widgets/gh-p/eb-custom-widgets&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2024 19:01:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-output-datasource/m-p/1412478#M12202</guid>
      <dc:creator>WDominguez-Zarate</dc:creator>
      <dc:date>2024-04-19T19:01:52Z</dc:date>
    </item>
  </channel>
</rss>

