<?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 Create dynamic sublayer in MapImageLayer using a join-table with a query-table in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-dynamic-sublayer-in-mapimagelayer-using-a/m-p/1149973#M76560</link>
    <description>&lt;P&gt;As the title suggests, I am currently attempting to create a dynamic sublayer for a MapImageLayer using a join-table method. For the leftTableSource I have a simple polyline layer, and on the rightTableSource I have a data-layer being created from a query-table.&lt;/P&gt;&lt;P&gt;I can create a table-join if I set the rightTableSource as a table rather than a query-table, but that doesn't allow me to run the query features I need to filter duplicate occurrences dynamically. The fact that the join-table works with a table vs a query-table makes me think something is wrong in the syntax setting up the join.&lt;/P&gt;&lt;P&gt;For reference the data being reference in the query-table is in a registered dynamic workspace and the db behind the services is running in postgres.&lt;/P&gt;&lt;P&gt;Does anyone see anything obviously wrong in this code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I replaced some of our private information with &amp;lt;...&amp;gt;.&lt;BR /&gt;The variable 'where' is assigned previous to layer being created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let layer = new MapImageLayer({
	url: &amp;lt;url to our MapServer&amp;gt;,
	sublayers: [{
		id: 0,
		renderer: this.Global.Accessor.visuals.classBreaksRenderer,
		definitionExpression: where,
		opacity: 1,
		source: {
			type: "data-layer",
			dataSource: {
				type: "join-table",
				leftTableSource: {
					type: "map-layer",
					mapLayerId: 1
				},
				rightTableSource: {
					type: "data-layer",
					dataSource: {
						type: "query-table",
						workspaceId: &amp;lt;workspaceName&amp;gt;,
						dataSourceName: &amp;lt;dataSourceName&amp;gt;,
						query: `SELECT distinct segmentid, COUNT(collision_id) AS cnt, borough, zip_code FROM &amp;lt;dataSourceName&amp;gt; WHERE ${where} GROUP BY segmentid, borough, zip_code`
					}
				},
				leftTableKey: "segmentid",
				rightTableKey: "segmentid",
				joinType: "left-outer-join"
			}
		}
	}]
});&lt;/LI-CODE&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>Thu, 03 Mar 2022 17:51:51 GMT</pubDate>
    <dc:creator>GiovanniPopulis</dc:creator>
    <dc:date>2022-03-03T17:51:51Z</dc:date>
    <item>
      <title>Create dynamic sublayer in MapImageLayer using a join-table with a query-table</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-dynamic-sublayer-in-mapimagelayer-using-a/m-p/1149973#M76560</link>
      <description>&lt;P&gt;As the title suggests, I am currently attempting to create a dynamic sublayer for a MapImageLayer using a join-table method. For the leftTableSource I have a simple polyline layer, and on the rightTableSource I have a data-layer being created from a query-table.&lt;/P&gt;&lt;P&gt;I can create a table-join if I set the rightTableSource as a table rather than a query-table, but that doesn't allow me to run the query features I need to filter duplicate occurrences dynamically. The fact that the join-table works with a table vs a query-table makes me think something is wrong in the syntax setting up the join.&lt;/P&gt;&lt;P&gt;For reference the data being reference in the query-table is in a registered dynamic workspace and the db behind the services is running in postgres.&lt;/P&gt;&lt;P&gt;Does anyone see anything obviously wrong in this code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I replaced some of our private information with &amp;lt;...&amp;gt;.&lt;BR /&gt;The variable 'where' is assigned previous to layer being created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let layer = new MapImageLayer({
	url: &amp;lt;url to our MapServer&amp;gt;,
	sublayers: [{
		id: 0,
		renderer: this.Global.Accessor.visuals.classBreaksRenderer,
		definitionExpression: where,
		opacity: 1,
		source: {
			type: "data-layer",
			dataSource: {
				type: "join-table",
				leftTableSource: {
					type: "map-layer",
					mapLayerId: 1
				},
				rightTableSource: {
					type: "data-layer",
					dataSource: {
						type: "query-table",
						workspaceId: &amp;lt;workspaceName&amp;gt;,
						dataSourceName: &amp;lt;dataSourceName&amp;gt;,
						query: `SELECT distinct segmentid, COUNT(collision_id) AS cnt, borough, zip_code FROM &amp;lt;dataSourceName&amp;gt; WHERE ${where} GROUP BY segmentid, borough, zip_code`
					}
				},
				leftTableKey: "segmentid",
				rightTableKey: "segmentid",
				joinType: "left-outer-join"
			}
		}
	}]
});&lt;/LI-CODE&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>Thu, 03 Mar 2022 17:51:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-dynamic-sublayer-in-mapimagelayer-using-a/m-p/1149973#M76560</guid>
      <dc:creator>GiovanniPopulis</dc:creator>
      <dc:date>2022-03-03T17:51:51Z</dc:date>
    </item>
  </channel>
</rss>

