<?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: Python code  in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-code/m-p/277411#M21402</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume the C is a new field; right? if yes this will not work as I can't add field as I don't have admin privileges on this GDB.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Dec 2019 11:24:42 GMT</pubDate>
    <dc:creator>eyadghatasheh</dc:creator>
    <dc:date>2019-12-04T11:24:42Z</dc:date>
    <item>
      <title>Python code</title>
      <link>https://community.esri.com/t5/python-questions/python-code/m-p/277409#M21400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pros;&lt;/P&gt;&lt;P&gt;I have this table&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/475228_code.jpg" /&gt;&lt;/P&gt;&lt;P&gt;and need to take the numbers after hyphen in &lt;STRONG&gt;CAD_DESIGN_ROOMID&lt;/STRONG&gt; field and put it before the last three letters in &lt;STRONG&gt;ROOMCODE&lt;/STRONG&gt; field with another hyphen. I need the result to look like this :&amp;nbsp;&lt;/P&gt;&lt;P&gt;ART-S-01-00-1050-1-(OFS)&amp;nbsp;&lt;/P&gt;&lt;P&gt;ART-S-01-00-1050-2-(OFS)&amp;nbsp;&lt;/P&gt;&lt;P&gt;ART-S-01-00-1050-3-(OFS)&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;ART-S-01-00-1050-19-(OFS)&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any idea how I can do that in python. considering I am working in an &lt;STRONG&gt;SDE GDB&lt;/STRONG&gt; and can't add more fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2019 09:40:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-code/m-p/277409#M21400</guid>
      <dc:creator>eyadghatasheh</dc:creator>
      <dc:date>2019-12-04T09:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python code</title>
      <link>https://community.esri.com/t5/python-questions/python-code/m-p/277410#M21401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;with a code block and you replacing 'a' and 'b' with their appropriate fieldnames in double ! marks&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;a &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ART-S-01-00-1050(OFS)"&lt;/SPAN&gt;
b &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"1050A-1"&lt;/SPAN&gt;
c &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; a&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"("&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"-"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; b&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"-"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"-("&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; a&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"("&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

c
&lt;SPAN class="string token"&gt;'ART-S-01-00-1050-1-(OFS)'&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ---- a = !a_field!  b = !b_field!&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;P&gt;But you had better have an undo or check your results before committing the results.... otherwise, its on you &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:30:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-code/m-p/277410#M21401</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T13:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Python code</title>
      <link>https://community.esri.com/t5/python-questions/python-code/m-p/277411#M21402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume the C is a new field; right? if yes this will not work as I can't add field as I don't have admin privileges on this GDB.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2019 11:24:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-code/m-p/277411#M21402</guid>
      <dc:creator>eyadghatasheh</dc:creator>
      <dc:date>2019-12-04T11:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python code</title>
      <link>https://community.esri.com/t5/python-questions/python-code/m-p/277412#M21403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;c is a ... it would be best if it went into a new field, but if you have to overwrite 'a' then you would do the field calculation on it.&amp;nbsp; A practice I am not recommending (except on a backup copy of the table)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2019 11:31:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-code/m-p/277412#M21403</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-12-04T11:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python code</title>
      <link>https://community.esri.com/t5/python-questions/python-code/m-p/277413#M21404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a million Dan;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think we have to remove the &lt;STRONG&gt;+ "-"&lt;/STRONG&gt; after the first part ( &lt;STRONG&gt;a.split("(")[0]&lt;/STRONG&gt; ) as it gives double hyphen in the result like&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;ART-S-01-00-1050&lt;STRONG&gt;--&lt;/STRONG&gt;1-(OFS)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but anyway, this was helpful, many thanks again&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Dec 2019 11:49:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-code/m-p/277413#M21404</guid>
      <dc:creator>eyadghatasheh</dc:creator>
      <dc:date>2019-12-04T11:49:38Z</dc:date>
    </item>
  </channel>
</rss>

