<?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 Check for the existence of a value in a field in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/check-for-the-existence-of-a-value-in-a-field/m-p/844659#M3632</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ArcGIS API for Python 1.7.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We currently have a script that writes to a feature layer in our Portal that records the username and last login of all users who logged in within the last 24 hours. Each night it wipes all records in the layer and writes new ones, again, for only the usernames who have logged in within the past 24 hours.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Our goal now is to identify "power users", meaning those who logged in &lt;STRONG&gt;at least once&lt;/STRONG&gt;&amp;nbsp;in the last 24 hours. We're writing to a new layer in the feature service. The goal is to have some sort of counter which is updated every night, and each value in the 'username' field is their username, and a count field will be updated. The part I'm struggling with is determining if the username value already exists in the username field, and if so, just send an&amp;nbsp;edit_features(updates=). Otherwise, if the username value does not exist, send an edit_features(adds=).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any general guidance on how this would be accomplished would be truly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Feb 2020 17:47:23 GMT</pubDate>
    <dc:creator>EricAnderson_DHS</dc:creator>
    <dc:date>2020-02-27T17:47:23Z</dc:date>
    <item>
      <title>Check for the existence of a value in a field</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/check-for-the-existence-of-a-value-in-a-field/m-p/844659#M3632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ArcGIS API for Python 1.7.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We currently have a script that writes to a feature layer in our Portal that records the username and last login of all users who logged in within the last 24 hours. Each night it wipes all records in the layer and writes new ones, again, for only the usernames who have logged in within the past 24 hours.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Our goal now is to identify "power users", meaning those who logged in &lt;STRONG&gt;at least once&lt;/STRONG&gt;&amp;nbsp;in the last 24 hours. We're writing to a new layer in the feature service. The goal is to have some sort of counter which is updated every night, and each value in the 'username' field is their username, and a count field will be updated. The part I'm struggling with is determining if the username value already exists in the username field, and if so, just send an&amp;nbsp;edit_features(updates=). Otherwise, if the username value does not exist, send an edit_features(adds=).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any general guidance on how this would be accomplished would be truly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2020 17:47:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/check-for-the-existence-of-a-value-in-a-field/m-p/844659#M3632</guid>
      <dc:creator>EricAnderson_DHS</dc:creator>
      <dc:date>2020-02-27T17:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Check for the existence of a value in a field</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/check-for-the-existence-of-a-value-in-a-field/m-p/844660#M3633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can get a list of the unique values in a column from a spatially-enabled data frame, for example:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;power_users &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; power_users_layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;query&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;as_df&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
existing_users &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; power_users&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;username&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;unique&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&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;Then use the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;in&lt;/SPAN&gt; operator to check if a given user is in that list. If you post the code you have so far we could give some more specific guidance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:20:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/check-for-the-existence-of-a-value-in-a-field/m-p/844660#M3633</guid>
      <dc:creator>J_R_Matchett</dc:creator>
      <dc:date>2021-12-12T10:20:59Z</dc:date>
    </item>
  </channel>
</rss>

