<?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: Longest string of ALL cells of a table. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38065#M2970</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it is going to be a "sub" function for the FindLabel function. I need it for calculating a number of empty spaces in a label, which depends on the max number of characters, etc. It's all to make multi-row labels nicely justified, regardless of varying nature of data that go into labels. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Aug 2014 21:12:32 GMT</pubDate>
    <dc:creator>AlexZhuk</dc:creator>
    <dc:date>2014-08-26T21:12:32Z</dc:date>
    <item>
      <title>Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38060#M2965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to find the longest string of ALL cells of a table. Unfortunately, the table can have varying number of fields each time. Is it doable?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 20:52:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38060#M2965</guid>
      <dc:creator>AlexZhuk</dc:creator>
      <dc:date>2014-08-26T20:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38061#M2966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alex,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; What context are you asking this question in? Are you talking about a certain API, desktop, or what?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 20:57:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38061#M2966</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2014-08-26T20:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38062#M2967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;this is for the labeling expression in Desktop. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 21:00:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38062#M2967</guid>
      <dc:creator>AlexZhuk</dc:creator>
      <dc:date>2014-08-26T21:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38063#M2968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes...but how to you intend to implement it?&amp;nbsp; It also seems like a lot of work to read every record in every field in a table looking for the longest.&amp;nbsp; Can you provide some context as to why this is needed?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 21:06:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38063#M2968</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-08-26T21:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38064#M2969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The label expression itself can only "see" the one row of the table being used to label each feature. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that length is only defined for strings, for non-string fields you'd have to convert to text (using some formatting rule) before you could calculate a length. This could be done using a Python script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you explain what you're trying to do? That may help us answer your question with little more intelligence.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 21:09:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38064#M2969</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-08-26T21:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38065#M2970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it is going to be a "sub" function for the FindLabel function. I need it for calculating a number of empty spaces in a label, which depends on the max number of characters, etc. It's all to make multi-row labels nicely justified, regardless of varying nature of data that go into labels. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 21:12:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38065#M2970</guid>
      <dc:creator>AlexZhuk</dc:creator>
      <dc:date>2014-08-26T21:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38066#M2971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have something already , unfortunately, the separate parts of it work, but together they don"t &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Function.png" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/5160_Function.png" style="width: 620px; height: 475px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 21:19:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38066#M2971</guid>
      <dc:creator>AlexZhuk</dc:creator>
      <dc:date>2014-08-26T21:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38067#M2972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;function(*argums)&lt;/SPAN&gt; allows for varying list of arguments to be accepted.&lt;/P&gt;&lt;P&gt;the &lt;SPAN style="text-decoration: underline;"&gt;frame&lt;/SPAN&gt; part inspects the function's "input". These things work fine separately.&lt;/P&gt;&lt;P&gt;Here, however, the &lt;SPAN style="text-decoration: underline;"&gt;for&lt;/SPAN&gt; loop completely ignores the frame.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need this as a generic solution for the labels like shown here. Currently I need to calculate the longest strings manually.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="exmp.png" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/5161_exmp.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 21:28:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38067#M2972</guid>
      <dc:creator>AlexZhuk</dc:creator>
      <dc:date>2014-08-26T21:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38068#M2973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seems to me an approach that has a better chance of working is to to determine a label expression from your data and update it into the layer object rather than attempting to do all this processing in the labeling context.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or maybe I'm missing what you are doing again?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, see &lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 21:30:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38068#M2973</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-08-26T21:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38069#M2974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The data come from a SQL Server DB, where I have no control, and can't create extra columns, etc. So the processing has to happen on the label side, for better or worse. The tables are different every time, as the number and name of fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 21:36:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38069#M2974</guid>
      <dc:creator>AlexZhuk</dc:creator>
      <dc:date>2014-08-26T21:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38070#M2975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey you looked at python's string formatting using their center, left justify, and right justify?&amp;nbsp; You can set the number of of characters a string needs to be then it autofills the remaining spaces in a string with spaces to the specified number.&amp;nbsp; If you determine the max string length prior, you can just input the width in the string method and (hopefully) it would work for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;string.ljust for left justified&lt;/P&gt;&lt;P&gt;string.rjust for right justified&lt;/P&gt;&lt;P&gt;string.center for centered. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.python.org/2/library/string.html" title="https://docs.python.org/2/library/string.html"&gt;7.1. string — Common string operations — Python v2.7.8 documentation&lt;/A&gt; very bottom of the page.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 21:43:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38070#M2975</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2014-08-26T21:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38071#M2976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert, I added a few notes below.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 21:43:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38071#M2976</guid>
      <dc:creator>AlexZhuk</dc:creator>
      <dc:date>2014-08-26T21:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38072#M2977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ian,&lt;/P&gt;&lt;P&gt;Thanks, I'll take a look at your links. Basically this is what I've been trying to do. My label data rows consist of a combination of, at least, two field values. I'm trying to calculate the max length of the box (fixed-width font is important here) and fill in all the empty spaces with respective number of space characters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 21:55:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38072#M2977</guid>
      <dc:creator>AlexZhuk</dc:creator>
      <dc:date>2014-08-26T21:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38073#M2978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd recommend probably splitting it up into two seperate strings, each with a maximum string length.&amp;nbsp; So your first string I guess you need left justified for the value of field one, with a max length of x(x being longest string in field) then concatenate that with a second string for the values of field two justified rightwith max length of y(ditto)(Since&amp;nbsp; you mentioned you wanted similar to the example you posted).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 22:05:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38073#M2978</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2014-08-26T22:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Longest string of ALL cells of a table.</title>
      <link>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38074#M2979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is more or less what I've been trying to do, but I still need the max length of the values, as well as max length of the field names. Otherwise I (and my other users) will have to calculate the numbers manually. I want to avoid it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, this kind of labels are called "spider diagrams" and are popular in the environmental industry, whether we like them or not.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Aug 2014 22:20:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/longest-string-of-all-cells-of-a-table/m-p/38074#M2979</guid>
      <dc:creator>AlexZhuk</dc:creator>
      <dc:date>2014-08-26T22:20:16Z</dc:date>
    </item>
  </channel>
</rss>

