<?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 Adding Tables and Layers to Table Widget programatically in ExB Dev in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/adding-tables-and-layers-to-table-widget/m-p/1575743#M16907</link>
    <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;Is there way to add datasource table or layer programatically within the code to Table Widget leveraging the "Add To Table" data action?&amp;nbsp;My custom widget in exb dev 1.14 adds a portal hosted feature layers item (generated by python web tool) to the map using similar logic to Add Data widget by publishing a message the layers get added to map automatically, but not the tables... I need to display my non spatial tables somehow in Table Widget.&lt;/P&gt;&lt;P&gt;Any advice much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jan 2025 12:40:28 GMT</pubDate>
    <dc:creator>SerjStol</dc:creator>
    <dc:date>2025-01-15T12:40:28Z</dc:date>
    <item>
      <title>Adding Tables and Layers to Table Widget programatically in ExB Dev</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/adding-tables-and-layers-to-table-widget/m-p/1575743#M16907</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;Is there way to add datasource table or layer programatically within the code to Table Widget leveraging the "Add To Table" data action?&amp;nbsp;My custom widget in exb dev 1.14 adds a portal hosted feature layers item (generated by python web tool) to the map using similar logic to Add Data widget by publishing a message the layers get added to map automatically, but not the tables... I need to display my non spatial tables somehow in Table Widget.&lt;/P&gt;&lt;P&gt;Any advice much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 12:40:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/adding-tables-and-layers-to-table-widget/m-p/1575743#M16907</guid>
      <dc:creator>SerjStol</dc:creator>
      <dc:date>2025-01-15T12:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Tables and Layers to Table Widget programatically in ExB Dev</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/adding-tables-and-layers-to-table-widget/m-p/1577112#M16995</link>
      <description>&lt;P&gt;Hi SerjStol, you can try updating the table widget's mutableStoreValue "viewInTableObj" and widgetStateProp "dataActionActiveObj" like the add-to-table action. The table widget will do the rest.&lt;/P&gt;&lt;P&gt;The first one will add the data to the table. The second one will open the data's tab.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Allen_Zhang_0-1737342670504.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/123592iE4E1091D49749B5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Allen_Zhang_0-1737342670504.png" alt="Allen_Zhang_0-1737342670504.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2025 03:11:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/adding-tables-and-layers-to-table-widget/m-p/1577112#M16995</guid>
      <dc:creator>Allen_Zhang</dc:creator>
      <dc:date>2025-01-20T03:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Tables and Layers to Table Widget programatically in ExB Dev</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/adding-tables-and-layers-to-table-widget/m-p/1578658#M17086</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/832963"&gt;@Allen_Zhang&lt;/a&gt;&amp;nbsp;, I will try it, currently managed to get Table Widget Id programatically, next i need to make data sources from the non spatial tables I think, then try use your code to add them to table.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 14:39:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/adding-tables-and-layers-to-table-widget/m-p/1578658#M17086</guid>
      <dc:creator>SerjStol</dc:creator>
      <dc:date>2025-01-24T14:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Tables and Layers to Table Widget programatically in ExB Dev</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/adding-tables-and-layers-to-table-widget/m-p/1579319#M17125</link>
      <description>&lt;P&gt;In the end i managed to access and execute "AddToTable" data action programatically, I first create DataRecord[] array from my DataSource that I previously create from my output feature layer. DataSource has function to getSourceRecords(). Then you get the addToTable data action from DataActionManager instance by getting supportedDataActions or you could just getActions() and then invoke executeDataAction method like so. You must obtain your table widget ID, either hard code it or get it programmatically like i do. I could then add non spatial tables or feature layer that are in my output hosted feature layer to Table Widget programmatically &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// This will return DataSource
      const incidentDs = await createDataSourceByLayer(outputLyrUrl);
      
      // get records of the data source
      const records = incidentDs.getSourceRecords();
      
      const dataSets = {
        records: records,
        dataSource: incidentDs, 
        name: incidentDs.getLabel() 
      };
      
      // Get data actions, could also use getActions()
      const actions = await DataActionManager.getInstance().getSupportedActions(
        props.id,
        [dataSets],
        DataLevel.DataSource
      );
      console.log("Supported actions:", actions)
      
// get addtotable data action types, but this is an array
      const addToTableAction = actions.addToTable;

      console.log("Add to table aciton", addToTableAction)
      
      if (addToTableAction?.length &amp;gt; 0) {
        
        // Execute add to table action on table widget
        await DataActionManager.getInstance().executeDataAction(
          addToTableAction[0],
          [dataSets],
          DataLevel.DataSource,
          tableWidgetId
        );
         
      } else {
        console.warn("No  actions available.");
      }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 23:02:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/adding-tables-and-layers-to-table-widget/m-p/1579319#M17125</guid>
      <dc:creator>SerjStol</dc:creator>
      <dc:date>2025-01-27T23:02:59Z</dc:date>
    </item>
  </channel>
</rss>

