<?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: Script tool: Inputting a list of rasters and fields in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/script-tool-inputting-a-list-of-rasters-and-fields/m-p/1254523#M66780</link>
    <description>&lt;P&gt;I've confirmed what&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7266"&gt;@ChrisRingo&lt;/a&gt;&amp;nbsp;describes above. When using a value table with feature layer and field pairs, the field column automatically receives a dependency on the feature layer column. When using a value table with raster layer and field pairs, this dependency is not achieved and does not appear like it can be forced. This is a defect that we will correct in a future release.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is not a workaround possible that I'm aware of at this time.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2023 19:28:00 GMT</pubDate>
    <dc:creator>DrewFlater</dc:creator>
    <dc:date>2023-02-02T19:28:00Z</dc:date>
    <item>
      <title>Script tool: Inputting a list of rasters and fields</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-inputting-a-list-of-rasters-and-fields/m-p/1254417#M66770</link>
      <description>&lt;P&gt;I am stumped on how to create an interface using either a Custom or a Python toolbox that will allow a user to input a list of raster layers and a selected field from each raster.&amp;nbsp; It seems as though a value table is the way to go, but although this works for feature layers, it apparently does not work for raster layers.&lt;/P&gt;&lt;P&gt;As illustrated in the following code snippet from a python toolbox and the resulting screenshot,&amp;nbsp; you can have a parameter that takes a single raster layer and another that takes a field with a dependency between the two, and you get a picklist of raster attributes as expected (provided the raster has an attribute table).&amp;nbsp; And, using a value table to input multiple feature classes, you also get the expected picklist of attributes for each feature class. But you do not get the picklist using a value table with raster layers, as shown in the screen shot.&lt;/P&gt;&lt;P&gt;This value table functionality for feature layer/field pairs has apparently been around since Pro v 2.4 (according to this post by&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1125"&gt;@DrewFlater&lt;/a&gt;&amp;nbsp;--&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-questions/python-toolbox-value-table-with-list/m-p/546572/highlight/true#M42642" target="_blank"&gt;https://community.esri.com/t5/python-questions/python-toolbox-value-table-with-list/m-p/546572/highlight/true#M42642&lt;/A&gt;) - is there a plan to extend this to rasters as well? (or am I just missing something here?)&lt;/P&gt;&lt;P&gt;In the absence of having this functionality available using value tables, does anyone have ideas on how to accomplish this seemingly simple task -- i.e., a way for a user to enter a list of raster/field pairs? Any insights would be greatly appreciated - thank you!&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class Tool(object):
	def __init__(self):
		"""Define the tool (tool name is the name of the class)."""
		self.label = "Value Table Test"
		self.description = ""
		self.canRunInBackground = False

	def getParameterInfo(self):
		"""Define parameter definitions"""
		# Param0 is raster layer
		param0 = arcpy.Parameter(
			displayName = "Raster #1",
			name="Raster1",
			datatype="Raster Layer",
			parameterType="Optional",
			direction="Input")
			
		# Param1 is raster field
		param1 = arcpy.Parameter(
			displayName = "Raster #1 field",
			name="Raster1_field",
			datatype="Field",
			parameterType="Optional",
			direction="Input")
			
		param1.parameterDependencies = [param0.name]
		
		#param2 is a value table of feature layers &amp;amp; fields
		param2 = arcpy.Parameter(
			displayName = "Feature Layers",
			name="Feature_list",
			datatype="GPValueTable",
			parameterType="Optional",
			direction="Input")
			
		param2.columns = [["GPFeatureLayer", "Feature Layer"], ["Field", "Field Name"]]
		
		#param3 is a value table of raster layers and fields
		param3 = arcpy.Parameter(
			displayName = "Raster Layers",
			name="Raster_list",
			datatype="GPValueTable",
			parameterType="Optional",
			direction="Input")
			
		param3.columns = [["GPRasterLayer", "Raster Layer"], ["Field", "Field Name"]]
		
		params = [param0, param1, param2, param3]
		return params&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 17:30:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-inputting-a-list-of-rasters-and-fields/m-p/1254417#M66770</guid>
      <dc:creator>ChrisRingo</dc:creator>
      <dc:date>2023-02-02T17:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool: Inputting a list of rasters and fields</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-inputting-a-list-of-rasters-and-fields/m-p/1254523#M66780</link>
      <description>&lt;P&gt;I've confirmed what&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7266"&gt;@ChrisRingo&lt;/a&gt;&amp;nbsp;describes above. When using a value table with feature layer and field pairs, the field column automatically receives a dependency on the feature layer column. When using a value table with raster layer and field pairs, this dependency is not achieved and does not appear like it can be forced. This is a defect that we will correct in a future release.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is not a workaround possible that I'm aware of at this time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 19:28:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-inputting-a-list-of-rasters-and-fields/m-p/1254523#M66780</guid>
      <dc:creator>DrewFlater</dc:creator>
      <dc:date>2023-02-02T19:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Script tool: Inputting a list of rasters and fields</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-inputting-a-list-of-rasters-and-fields/m-p/1254539#M66781</link>
      <description>&lt;P&gt;Thanks much for confirming.&lt;/P&gt;&lt;P&gt;One other thing I forgot to mention - if you type in a valid field name - i.e., one that exists in the attribute table - the tool will accept it.&amp;nbsp; Conversely, it will throw an error if you type in a field name that doesn't exist in the table.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 19:42:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-inputting-a-list-of-rasters-and-fields/m-p/1254539#M66781</guid>
      <dc:creator>ChrisRingo</dc:creator>
      <dc:date>2023-02-02T19:42:53Z</dc:date>
    </item>
  </channel>
</rss>

