<?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: Create a Datasource from a FeatureLayer in Experience Builder Custom Widgets</title>
    <link>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1155061#M14</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1104"&gt;@RobertScheitlin__GISP&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please take a look at this (on show code)&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/experience-builder/storybook/?path=/docs/components-jimu-ui-advanced-data-source-selector-datasourceselector--single-selection-with-default-selected-ds" target="_blank"&gt;https://developers.arcgis.com/experience-builder/storybook/?path=/docs/components-jimu-ui-advanced-data-source-selector-datasourceselector--single-selection-with-default-selected-ds&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I think it might help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Mar 2022 22:03:39 GMT</pubDate>
    <dc:creator>Dvirus</dc:creator>
    <dc:date>2022-03-17T22:03:39Z</dc:date>
    <item>
      <title>Create a Datasource from a FeatureLayer</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1150689#M13</link>
      <description>&lt;P&gt;I am struggling to figure out how to create a DataSource from a FeatureLayer that is created in a Widget.tsx.&lt;/P&gt;&lt;P&gt;I am not allowing the user to select a DataSource, I am creating a FeatureLayer in code and then adding it to the map. Now I want to open this&amp;nbsp;FeatureLayer in the Table widget so I need a DataSource to pass.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/54255"&gt;@ShengdiZhang&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 15:41:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1150689#M13</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2022-03-04T15:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Datasource from a FeatureLayer</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1155061#M14</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1104"&gt;@RobertScheitlin__GISP&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please take a look at this (on show code)&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/experience-builder/storybook/?path=/docs/components-jimu-ui-advanced-data-source-selector-datasourceselector--single-selection-with-default-selected-ds" target="_blank"&gt;https://developers.arcgis.com/experience-builder/storybook/?path=/docs/components-jimu-ui-advanced-data-source-selector-datasourceselector--single-selection-with-default-selected-ds&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I think it might help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 22:03:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1155061#M14</guid>
      <dc:creator>Dvirus</dc:creator>
      <dc:date>2022-03-17T22:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Datasource from a FeatureLayer</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1243900#M53</link>
      <description>&lt;P&gt;I am facing the same problem for the same reasons. My widget creates a FeatureLayer and I would like this FeatureLayer to be viewed in the AttributeTable. I have no input datasource. Thanks for any suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 22:25:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1243900#M53</guid>
      <dc:creator>clc</dc:creator>
      <dc:date>2022-12-27T22:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Datasource from a FeatureLayer</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1272853#M62</link>
      <description>&lt;P&gt;Did you ever solve this? I've been trying to figure out how to do this as well. The documentation seems to imply this is possible/expected, but the documentation and examples aren't of much help.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 00:05:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1272853#M62</guid>
      <dc:creator>agrescavage</dc:creator>
      <dc:date>2023-03-29T00:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Datasource from a FeatureLayer</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1275592#M63</link>
      <description>&lt;P&gt;Nope.&lt;/P&gt;&lt;P&gt;I agreed the documentation seems to imply that it is possible but it remained&amp;nbsp; mystery for me. I tried to use their example in the Widget Development guide: "1.2 Use a widget's output data source" with a dummy input data source (to get the schema), but I still cannot figure how to load my own generated features. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 22:37:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1275592#M63</guid>
      <dc:creator>clc</dc:creator>
      <dc:date>2023-04-04T22:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Datasource from a FeatureLayer</title>
      <link>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1277397#M64</link>
      <description>&lt;P&gt;So I came back to it and managed to get a solution with my dummy input source. I used the Esri example&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;"1.2 Use a widget's output data source" for the setting.tsx file. Then in my widget.tsx file, I did not use the&amp;nbsp;DataSourceComponent and just use the DataSourceManager to get an instance of my output datasource:&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt;&lt;SPAN&gt; [&lt;/SPAN&gt;&lt;SPAN&gt;myDSout&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;setMyDSout&lt;/SPAN&gt;&lt;SPAN&gt;] = &lt;/SPAN&gt;&lt;SPAN&gt;useState&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;FeatureLayerDataSource&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;(&lt;/SPAN&gt;&lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;DataSourceManager&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getInstance&lt;/SPAN&gt;&lt;SPAN&gt;().&lt;/SPAN&gt;&lt;SPAN&gt;createDataSource&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;props&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;outputDataSources&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;]).&lt;/SPAN&gt;&lt;SPAN&gt;then&lt;/SPAN&gt;&lt;SPAN&gt;((&lt;/SPAN&gt;&lt;SPAN&gt;result&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;FeatureLayerDataSource&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;setMyDSout&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;result&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; })&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Then from my array of graphics, I created and array of records and used the&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;setSourceRecords method. Finally just like in their example, I used the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;setStatus&amp;nbsp; et setCountStatus method.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;As you can see, I did not use the dummy input datasource at all in the widget.tsx file, it was just in the setting.tsx file to provide a data source id for my output datasource. I'd like to get rid of this dummy input data source as the Esri documentation states that in the createDataSource method of the DataSourceManager: "The parameter can be a data source id, data source config JSON or DataSourceConstructorOptions" but I have been unsuccessful.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I tried to pass the following parameter:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;myOutJson&lt;/SPAN&gt;&lt;SPAN&gt; = {&lt;/SPAN&gt;&l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SPAN&gt;isDataInDataSourceInstance&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;isOutputFromWidget&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;true&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; } &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;IMDataSourceJson&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But I got the following error: "Datasource without origin data source must save the schema in app config." which was mentioned in their documentation. I tried to add a schema file in my app config, but do not know the exact syntax (and I am not sure that my parameter outOutJson is right either...) .&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any help for creating a&amp;nbsp;data source config JSON would be appreciated.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 11 Apr 2023 16:16:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/experience-builder-custom-widgets/create-a-datasource-from-a-featurelayer/m-p/1277397#M64</guid>
      <dc:creator>clc</dc:creator>
      <dc:date>2023-04-11T16:16:37Z</dc:date>
    </item>
  </channel>
</rss>

