<?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: Setting default values in Value Tables (script tools) in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/setting-default-values-in-value-tables-script/m-p/1164675#M54082</link>
    <description>&lt;P data-unlink="true"&gt;Yes, I reviewed the&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/valuetable.htm" target="_blank" rel="noopener"&gt;Value Table help page&lt;/A&gt;&amp;nbsp;, as well as multiple&amp;nbsp;pages on script tool parameters, including the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/parameter.htm" target="_self"&gt;Parameter object's help page&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;I was able to get default to show up by pasting them into the normal default field in the script tool parameter page, using the format:&lt;/P&gt;&lt;P data-unlink="true"&gt;Col1A [space] Col2A; Col1B [space] Col2B&lt;/P&gt;&lt;P data-unlink="true"&gt;The column values are separated by spaces, and the rows are separated by semicolons. You will have to place any values that have spaces in them ("Maria's Pizzeria") in quotes.&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;However, I would like to set these in the Validation page to make setting them easier to read.&lt;/P&gt;&lt;P data-unlink="true"&gt;I've tried using self.params[N].values== [[Col1A, Col2A], [Col1B, Col2B]] (read: a list of lists, as hinted at in the parameter help page for value tables) under both&amp;nbsp;&lt;STRONG&gt;&lt;SPAN class=""&gt;initializeParameters&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;(self) and &lt;STRONG&gt;updateParameters&lt;/STRONG&gt;(self) with no luck.&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;SPAN class=""&gt;Under updateParameters, I was predicating it on self.params[N].altered, and while that worked for other things, it did not work for this one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;U&gt;&lt;SPAN class=""&gt;What is a clean way to set the defaults of a value table in the validation page of a script tool?&lt;/SPAN&gt;&lt;/U&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Apr 2022 02:11:39 GMT</pubDate>
    <dc:creator>AlfredBaldenweck</dc:creator>
    <dc:date>2022-04-15T02:11:39Z</dc:date>
    <item>
      <title>Setting default values in Value Tables (script tools)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/setting-default-values-in-value-tables-script/m-p/1164222#M54023</link>
      <description>&lt;P&gt;Pretty much what it says on the tin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I set default values for Value Tables in my script tool parameters?&lt;/P&gt;&lt;P&gt;Either having it as a default when the tool is opened, or a contingent value (i.e. if you pick on value in Column 1, column 2 will automatically be populated)?&lt;/P&gt;&lt;P&gt;Value Tables are more difficult to work with than I'd hoped.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 01:11:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/setting-default-values-in-value-tables-script/m-p/1164222#M54023</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2022-04-14T01:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Setting default values in Value Tables (script tools)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/setting-default-values-in-value-tables-script/m-p/1164245#M54024</link>
      <description>&lt;P&gt;Did you see the examples in the help topic?&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/valuetable.htm" target="_blank"&gt;ValueTable—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 03:02:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/setting-default-values-in-value-tables-script/m-p/1164245#M54024</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-04-14T03:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Setting default values in Value Tables (script tools)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/setting-default-values-in-value-tables-script/m-p/1164675#M54082</link>
      <description>&lt;P data-unlink="true"&gt;Yes, I reviewed the&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/valuetable.htm" target="_blank" rel="noopener"&gt;Value Table help page&lt;/A&gt;&amp;nbsp;, as well as multiple&amp;nbsp;pages on script tool parameters, including the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/parameter.htm" target="_self"&gt;Parameter object's help page&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;I was able to get default to show up by pasting them into the normal default field in the script tool parameter page, using the format:&lt;/P&gt;&lt;P data-unlink="true"&gt;Col1A [space] Col2A; Col1B [space] Col2B&lt;/P&gt;&lt;P data-unlink="true"&gt;The column values are separated by spaces, and the rows are separated by semicolons. You will have to place any values that have spaces in them ("Maria's Pizzeria") in quotes.&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;However, I would like to set these in the Validation page to make setting them easier to read.&lt;/P&gt;&lt;P data-unlink="true"&gt;I've tried using self.params[N].values== [[Col1A, Col2A], [Col1B, Col2B]] (read: a list of lists, as hinted at in the parameter help page for value tables) under both&amp;nbsp;&lt;STRONG&gt;&lt;SPAN class=""&gt;initializeParameters&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;(self) and &lt;STRONG&gt;updateParameters&lt;/STRONG&gt;(self) with no luck.&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;SPAN class=""&gt;Under updateParameters, I was predicating it on self.params[N].altered, and while that worked for other things, it did not work for this one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;U&gt;&lt;SPAN class=""&gt;What is a clean way to set the defaults of a value table in the validation page of a script tool?&lt;/SPAN&gt;&lt;/U&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 02:11:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/setting-default-values-in-value-tables-script/m-p/1164675#M54082</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2022-04-15T02:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Setting default values in Value Tables (script tools)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/setting-default-values-in-value-tables-script/m-p/1350689#M75275</link>
      <description>&lt;P&gt;Hey Alfred,&lt;/P&gt;&lt;P&gt;I'm a bit late to the party, but who knows, maybe you can still use this or someone else.&lt;/P&gt;&lt;P&gt;I struggled with the same issue and finally found a way to do it, although it's not as straightforward as simply passing a list of lists.&lt;/P&gt;&lt;P&gt;I read out the parameter value as a text, created a ValueTable object and loaded the table's values from the parameter's string value. Then I applied the changes in the ValueTable using the methods and properties according to&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/valuetable.htm" target="_blank"&gt;ValueTable—ArcGIS Pro | Documentation&lt;/A&gt;. Here's my code snippet:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if self.params[0].value and not self.params[0].hasBeenValidated:
    vTbl = arcpy.ValueTable(3) # My parameter has 3 columns
    vTbl.loadFromString(self.params[0].valueAsText)
    for i in range(0, vTbl.rowCount):
        col1val = vTbl.getValue(i, 0)
        vTbl.setValue(i, 1, col2val)
        vTbl.setValue(i, 2, col3val)
    self.params[0].value = vTbl.exportToString()
return&lt;/LI-CODE&gt;&lt;P&gt;For your specific case, it might make sense to replace col2val and col3val with functions (outside of the class) that uses col1val as an input. I don't know exactly how you want to access the data. If those "contigent values" are acutally stored as contingent values, you should be able to access them via arcpy. What I did for another tool, is to have an excel file saved somewhere and then read the data with pandas.&lt;/P&gt;&lt;P&gt;Hope that helped!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 10:08:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/setting-default-values-in-value-tables-script/m-p/1350689#M75275</guid>
      <dc:creator>CSDING_GIS</dc:creator>
      <dc:date>2023-11-17T10:08:15Z</dc:date>
    </item>
  </channel>
</rss>

