<?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: Calculating a field to list another field's name in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634287#M49405</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd do it in field calculator with something along the lines Matt laid out, using a code block.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jul 2020 19:25:41 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2020-07-10T19:25:41Z</dc:date>
    <item>
      <title>Calculating a field to list another field's name</title>
      <link>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634282#M49400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Esri community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two fields that represent different event categories, each denoting the year a given event category occurred.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to calculate a new field that will list the field name of the event type with the maximum value (latest year).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way I can do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Event_type1 ;&amp;nbsp; Event_type2,&amp;nbsp; last_event_type&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; 1984 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 1972 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; event_type1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Also, I posted this in the Python community because I thought there might be a script that could perform this action, but if there is a better geonet community for this question please let me know.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2020 18:01:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634282#M49400</guid>
      <dc:creator>KaydenSim</dc:creator>
      <dc:date>2020-07-10T18:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a field to list another field's name</title>
      <link>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634283#M49401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you want to happen if two events happen in the same year? Can you give an example row in your dataset?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2020 18:15:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634283#M49401</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-07-10T18:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a field to list another field's name</title>
      <link>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634284#M49402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quickly off the top of my head something like this.&amp;nbsp; Are you trying to do this in a field calculator or in a script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Event_one &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Event_type1"&lt;/SPAN&gt;
Event_two &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;  &lt;SPAN class="string token"&gt;"Event_type2"&lt;/SPAN&gt;
Last_Event &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"last_event_type"&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; Event_one &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; Event_two&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   Last_Event &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Event_type1"&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   Last_Event &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Event_type2"&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:59:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634284#M49402</guid>
      <dc:creator>MattDriscoll1</dc:creator>
      <dc:date>2021-12-12T02:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a field to list another field's name</title>
      <link>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634285#M49403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for this!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Preferably in field calculator, but if a python script is the only way to do it, that will have to do.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2020 18:54:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634285#M49403</guid>
      <dc:creator>KaydenSim</dc:creator>
      <dc:date>2020-07-10T18:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a field to list another field's name</title>
      <link>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634286#M49404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If two events happen in the same year I would want the field to have the name of a third separate column.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2020 18:59:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634286#M49404</guid>
      <dc:creator>KaydenSim</dc:creator>
      <dc:date>2020-07-10T18:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a field to list another field's name</title>
      <link>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634287#M49405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd do it in field calculator with something along the lines Matt laid out, using a code block.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2020 19:25:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634287#M49405</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-07-10T19:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a field to list another field's name</title>
      <link>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634288#M49406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try Calculating the field using Expression Type Python.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Value&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;!Event_type1!&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;!Event_type2!&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code Block:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Value&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;x &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; y&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Event_type1"&lt;/SPAN&gt;  
    &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Event_type2"&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:59:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-a-field-to-list-another-field-s-name/m-p/634288#M49406</guid>
      <dc:creator>MatthewDriscoll</dc:creator>
      <dc:date>2021-12-12T02:59:03Z</dc:date>
    </item>
  </channel>
</rss>

