<?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: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610813#M74104</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3265"&gt;@TonyAlmeida&lt;/a&gt;&amp;nbsp;I'm so close! It was able to run in the field calculator - but now I'd like to get dots to even out so the index values are all aligned together. Similar to the first screenshot above. Below is what I have, is there a way to align the index values?&lt;/P&gt;&lt;P&gt;I really appreciate your help!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="table 2.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131263iC15769E672561108/image-size/medium?v=v2&amp;amp;px=400" role="button" title="table 2.png" alt="table 2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="table 3.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131264i5B0FDB78525A3666/image-size/medium?v=v2&amp;amp;px=400" role="button" title="table 3.png" alt="table 3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="field calculator 3.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131265i3D3D440966F78E92/image-size/large?v=v2&amp;amp;px=999" role="button" title="field calculator 3.png" alt="field calculator 3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;</description>
    <pubDate>Thu, 01 May 2025 16:11:41 GMT</pubDate>
    <dc:creator>JonM32</dc:creator>
    <dc:date>2025-05-01T16:11:41Z</dc:date>
    <item>
      <title>***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610783#M74098</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I'm trying to create a nice road index for a map. One that looks like the screenshot below. However, I can't figure out how to create the index so that my road name listed has periods filling in the remaining space before the index cell is listed.&lt;/P&gt;&lt;P&gt;So far, I found some examples of python to use but nothing specific to how to enter it into the field calculator in ArcGIS Pro. The table shows my two fields, one with the street name, the other with the index cell it falls in on my map.&lt;/P&gt;&lt;P&gt;Any help is appreciated!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Index example.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131254i7E9301E4B100425E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Index example.png" alt="Index example.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="table example.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131255iF49712E336763B22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="table example.png" alt="table example.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 15:11:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610783#M74098</guid>
      <dc:creator>JonM32</dc:creator>
      <dc:date>2025-05-01T15:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610791#M74099</link>
      <description>&lt;P&gt;this is a perfect use case for f-strings.&amp;nbsp;&lt;A href="https://fstring.help/" target="_blank"&gt;fstring.help: Python f-string guide&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;f"{!ALLROADNAM!:.&amp;lt;10}"&lt;/P&gt;&lt;P&gt;examples:&lt;/P&gt;&lt;P&gt;f"{'Done':.&amp;lt;12}" # Done.........&lt;BR /&gt;f"{123:.&amp;gt;8}" # .....123&lt;BR /&gt;f"{'Middle':.^10}" # ..Middle..&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 15:26:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610791#M74099</guid>
      <dc:creator>ClayDonaldsonSWCA</dc:creator>
      <dc:date>2025-05-01T15:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610794#M74100</link>
      <description>&lt;P&gt;try,&lt;/P&gt;&lt;LI-CODE lang="c"&gt;format_index(!Field1Cal!, !IndexCell!)&lt;/LI-CODE&gt;&lt;LI-CODE lang="c"&gt;def format_index(name, index, total_length=5): #change total_length
    name = name.strip()
    index = index.strip()
    dot_fill = '.' * max(1, total_length - len(name) - len(index))
    return f"{name}{dot_fill}{index}"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 15:37:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610794#M74100</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2025-05-01T15:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610799#M74101</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/261163"&gt;@ClayDonaldsonSWCA&lt;/a&gt;&amp;nbsp;Below is what I'm running into with the f-strings. Likely I'm entering it incorrectly, any idea whats going on?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="index error.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131260iD25385322B65D37B/image-size/large?v=v2&amp;amp;px=999" role="button" title="index error.png" alt="index error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 15:50:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610799#M74101</guid>
      <dc:creator>JonM32</dc:creator>
      <dc:date>2025-05-01T15:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610802#M74102</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3265"&gt;@TonyAlmeida&lt;/a&gt;&amp;nbsp;I tried your suggestion and am running into the issue below. Any idea what is going on? I did change the first part before the code block to match my field names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="index error 2.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131261iBA848CC13D7ECB34/image-size/large?v=v2&amp;amp;px=999" role="button" title="index error 2.png" alt="index error 2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 15:52:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610802#M74102</guid>
      <dc:creator>JonM32</dc:creator>
      <dc:date>2025-05-01T15:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610807#M74103</link>
      <description>&lt;P&gt;You probably have nulls, spaces and number and text.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try this,&lt;/P&gt;&lt;LI-CODE lang="c"&gt;def format_index(name, index, total_length=5):  # Change to your data 
    name = str(name).strip()  # String and strip whitespace
    index = str(index).strip()  # String and strip whitespace
    available_space = max(1, total_length - len(name) - len(index))
    dot_fill = '.' * available_space
    return f"{name}{dot_fill}{index}"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 01 May 2025 15:59:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610807#M74103</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2025-05-01T15:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610813#M74104</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3265"&gt;@TonyAlmeida&lt;/a&gt;&amp;nbsp;I'm so close! It was able to run in the field calculator - but now I'd like to get dots to even out so the index values are all aligned together. Similar to the first screenshot above. Below is what I have, is there a way to align the index values?&lt;/P&gt;&lt;P&gt;I really appreciate your help!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="table 2.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131263iC15769E672561108/image-size/medium?v=v2&amp;amp;px=400" role="button" title="table 2.png" alt="table 2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="table 3.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131264i5B0FDB78525A3666/image-size/medium?v=v2&amp;amp;px=400" role="button" title="table 3.png" alt="table 3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="field calculator 3.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131265i3D3D440966F78E92/image-size/large?v=v2&amp;amp;px=999" role="button" title="field calculator 3.png" alt="field calculator 3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 16:11:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610813#M74104</guid>
      <dc:creator>JonM32</dc:creator>
      <dc:date>2025-05-01T16:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610814#M74105</link>
      <description>&lt;P&gt;The expression is evaluating your field to include double quotes, and is therefore conflicting with your syntax. Change the code in your field calc to use single quotes instead of the double quotes will resolve the error:&amp;nbsp; f'{!ALLROADNAM!:.&amp;lt;10}'&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 16:12:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610814#M74105</guid>
      <dc:creator>AustinAverill</dc:creator>
      <dc:date>2025-05-01T16:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610816#M74106</link>
      <description>&lt;P&gt;try,&lt;/P&gt;&lt;P&gt;.ljust(total_length) # this should make sure the output string is exactly 50 characters wide&lt;/P&gt;&lt;LI-CODE lang="c"&gt;def format_index(name, index, total_length=50): 
    name = str(name).strip() if name else "Unknown"
    index = str(index).strip() if index else "--"
    available_space = max(1, total_length - len(name) - len(index))
    dot_fill = '.' * available_space
    return f"{name}{dot_fill}{index}".ljust(total_length)
    
format_index(!Field1Cal!, !IndexCell!)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 16:20:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610816#M74106</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2025-05-01T16:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610822#M74107</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/618314"&gt;@JonM32&lt;/a&gt;&amp;nbsp;, something like this will work in the Field Calculator without a Code Block if you prefer.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;!COUNTRY!+("..............."[:(15-(len(!COUNTRY!)))])+str(!MYINT!)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChrisUnderwood_1-1746117116467.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131267i1244351B4D6A3CD7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChrisUnderwood_1-1746117116467.png" alt="ChrisUnderwood_1-1746117116467.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 16:32:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610822#M74107</guid>
      <dc:creator>ChrisUnderwood</dc:creator>
      <dc:date>2025-05-01T16:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610875#M74108</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3265"&gt;@TonyAlmeida&lt;/a&gt;&amp;nbsp; Unless I entered it incorrectly, I keep having errors pop up when trying to run it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="index error 3.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131289iC7562176A5B31427/image-size/large?v=v2&amp;amp;px=999" role="button" title="index error 3.png" alt="index error 3.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 18:14:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610875#M74108</guid>
      <dc:creator>JonM32</dc:creator>
      <dc:date>2025-05-01T18:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610876#M74109</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/159762"&gt;@ChrisUnderwood&lt;/a&gt;&amp;nbsp;This worked, but the result is the same as above where I get uneven columns. The first screenshot in my initial post is my goal. I'd like to have the road names listed, and then have dots until the index cell is listed, but have them all line up together. Hopefully this makes sense!&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 18:15:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610876#M74109</guid>
      <dc:creator>JonM32</dc:creator>
      <dc:date>2025-05-01T18:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610882#M74110</link>
      <description>&lt;P&gt;perhaps a monospaced font would have to be specified, which is probably an unlikely case for field calculations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 18:34:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610882#M74110</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2025-05-01T18:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: ***Field Calculator Help*** How to pad a string with periods to fit remaining field length</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610904#M74111</link>
      <description>&lt;P&gt;Success! So, the solution is from both&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3265"&gt;@TonyAlmeida&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below are screenshots of the results and field calculator expression used.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The expression allowed for me to set a number for how many dots I'd like with the remaining space in a given text field. After running it, I still had alignment issues. However, I switch to a monospaced font (Courier New) and everything aligned perfectly! I plan to use this to create the final road index I'm making for a street map.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you everyone for your help!&lt;/P&gt;&lt;P&gt;Jon&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Success_index.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131298iC7CF03C3E16D8840/image-size/large?v=v2&amp;amp;px=999" role="button" title="Success_index.png" alt="Success_index.png" /&gt;&lt;/span&gt; &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Success_CalculatorView.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/131300iD3B56A90322D1532/image-size/large?v=v2&amp;amp;px=999" role="button" title="Success_CalculatorView.png" alt="Success_CalculatorView.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 19:14:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-help-how-to-pad-a-string-with/m-p/1610904#M74111</guid>
      <dc:creator>JonM32</dc:creator>
      <dc:date>2025-05-01T19:14:36Z</dc:date>
    </item>
  </channel>
</rss>

