<?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 How to use a variable with the function calculate () with ArcGIS API for Python in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-use-a-variable-with-the-function-calculate/m-p/838473#M3427</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;CODE class="" style="color: #000000; background: transparent; border: none; font-weight: bold;"&gt;&lt;SPAN class="" style="background: #f1c40f; font-weight: bold; padding: 0px 6px;"&gt;calculate&lt;/SPAN&gt;&lt;/CODE&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;where&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;calc_expression&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;sql_format='standard'&lt;/EM&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;lst_country = ["country1","&lt;SPAN&gt;country2&lt;/SPAN&gt;","&lt;SPAN&gt;country3&lt;/SPAN&gt;"]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for country in lst&amp;nbsp;&lt;SPAN&gt;lst_&lt;/SPAN&gt;&lt;SPAN&gt;country:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;update_result = commune_flayer.calculate(where="nom = &lt;SPAN style="color: #3d3d3d; font-weight: 400;"&gt;country&lt;/SPAN&gt;", calc_expression={"field": "date_horaire", "value": provinces.attributes['date_horaire']})&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Nov 2018 05:36:43 GMT</pubDate>
    <dc:creator>explocarto</dc:creator>
    <dc:date>2018-11-01T05:36:43Z</dc:date>
    <item>
      <title>How to use a variable with the function calculate () with ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-use-a-variable-with-the-function-calculate/m-p/838473#M3427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;CODE class="" style="color: #000000; background: transparent; border: none; font-weight: bold;"&gt;&lt;SPAN class="" style="background: #f1c40f; font-weight: bold; padding: 0px 6px;"&gt;calculate&lt;/SPAN&gt;&lt;/CODE&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;where&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;calc_expression&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;sql_format='standard'&lt;/EM&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;lst_country = ["country1","&lt;SPAN&gt;country2&lt;/SPAN&gt;","&lt;SPAN&gt;country3&lt;/SPAN&gt;"]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for country in lst&amp;nbsp;&lt;SPAN&gt;lst_&lt;/SPAN&gt;&lt;SPAN&gt;country:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;update_result = commune_flayer.calculate(where="nom = &lt;SPAN style="color: #3d3d3d; font-weight: 400;"&gt;country&lt;/SPAN&gt;", calc_expression={"field": "date_horaire", "value": provinces.attributes['date_horaire']})&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2018 05:36:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-use-a-variable-with-the-function-calculate/m-p/838473#M3427</guid>
      <dc:creator>explocarto</dc:creator>
      <dc:date>2018-11-01T05:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable with the function calculate () with ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-use-a-variable-with-the-function-calculate/m-p/838474#M3428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;'nom = "%s"'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; country
&lt;SPAN class="comment token"&gt;# or&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'nom = "{}"'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;country&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Look up Python string formatting.&amp;nbsp; Don't forget you need quotes around string values in where clauses.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:12:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-use-a-variable-with-the-function-calculate/m-p/838474#M3428</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-12-12T10:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable with the function calculate () with ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-use-a-variable-with-the-function-calculate/m-p/838475#M3429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'nom = "{}"'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;country&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" data-fulltext="" data-placeholder="Traduction" dir="ltr" style="color: #212121; background-color: #ffffff; border: none; font-size: 16px !important; padding: 0px 0.14em 0px 0px;"&gt;&lt;SPAN lang="en"&gt;It's good I finally found. It was necessary to declare this syntax&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;"nom = '{}'".format(country)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2018 23:28:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-use-a-variable-with-the-function-calculate/m-p/838475#M3429</guid>
      <dc:creator>explocarto</dc:creator>
      <dc:date>2018-11-01T23:28:55Z</dc:date>
    </item>
  </channel>
</rss>

