<?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: One to many labeling in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110367#M1378</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I changed the font you suggested, but still with different tabs. &lt;BR /&gt;Masked name for confidentiality reasons.[ATTACH=CONFIG]33889[/ATTACH]&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like you have 4 fields in your layout.&amp;nbsp; I would have to see your code for how you created those columns, since the code was not designed for more than 2 fields.&amp;nbsp; I would not expect the 4 fields to align correctly without significant code modification.&amp;nbsp; So are you now happy with what you got?&amp;nbsp; It appears your first column needs more space to deal with all values being less than 4 characters long.&amp;nbsp; Anyway, getting column headers and values to align was not part of the code I really changed or examined.&amp;nbsp; It does not appear to have a sophisticated enough algorithm to automatically adapt to any set of value and column name lengths.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Actually, I knew the code does not create alignments of the column headers relative to the values, so I am not surprised by the results.&amp;nbsp; I would like to see your code before trying to make the header value alignment algorithm better.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 18 May 2014 01:29:03 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2014-05-18T01:29:03Z</dc:date>
    <item>
      <title>One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110341#M1352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I know this is something we have been asking for forever, but I do not know if there is a real solution for this yet? Did anyone ever manage to recreate the "One to Many Label" script from VB6? Did ESRI finally give us a real solution to do the labeling? I saw one option of doing it using pivot tables that would require ArcInfo license, but that is a very roundabout solution using a license most people don't have. If anyone knows of a working solution please let me know.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you don't know what I am talking about, basically I am looking to make "callout box" type of labels such as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;MW01&amp;nbsp;&amp;nbsp; DEPTH&amp;nbsp;&amp;nbsp; BENZENE&amp;nbsp;&amp;nbsp; XYLENE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 34&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.78&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Sep 2013 19:51:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110341#M1352</guid>
      <dc:creator>NaseefChowdhury</dc:creator>
      <dc:date>2013-09-10T19:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110342#M1353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I know this is something we have been asking for forever, but I do not know if there is a real solution for this yet? Did anyone ever manage to recreate the "One to Many Label" script from VB6? Did ESRI finally give us a real solution to do the labeling? I saw one option of doing it using pivot tables that would require ArcInfo license, but that is a very roundabout solution using a license most people don't have. If anyone knows of a working solution please let me know.&lt;BR /&gt;&lt;BR /&gt;If you don't know what I am talking about, basically I am looking to make "callout box" type of labels such as:&lt;BR /&gt;&lt;BR /&gt;MW01&amp;nbsp;&amp;nbsp; DEPTH&amp;nbsp;&amp;nbsp; BENZENE&amp;nbsp;&amp;nbsp; XYLENE&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 34&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.78&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have not updated the VB6 script, but have created a Python script that can be used in an Advanced Label expression using the Python parser.&amp;nbsp; As written, thin code is designed for version 10.1 or later, since it used the data access module.&amp;nbsp; It could be adapted to work with 10.0 cursors, but I do not think Python labels are supported prior to 10.0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At this point I have not attempting to develop a label anywhere near the complexity of the one you want.&amp;nbsp; That will come later.&amp;nbsp; But for now I have developed the core fundamental script that will build a simpler one-to-many relationship stacked label.&amp;nbsp; The code below will create a label that lists the input value of the relate field from the parent table and then stacks underneath it the values of another field in a related table from all of the records that matched the input value in the related table's relate field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy # variables that need to be customized for your specific data def FindLabel ( [FULL_NAME] ): # input the field name of the parent table's relate field &amp;nbsp; inputValue = [FULL_NAME] # repeat the parent table's relate field &amp;nbsp; queryValue = "'" + inputValue + "'" # add query value delimiters for strings or dates here &amp;nbsp; # define the data source path and fields of the related table &amp;nbsp; featureClass = r'\\agency\agencydfs\Trans\rfairhur\Layers\PARCEL_LINES.gdb\ADDRESS_POINT_Locate_JURUP' &amp;nbsp; relatedFieldName = "FULL_NAME" # the relate field name in the related table that corresponds to the input field &amp;nbsp; valueFieldName = "HOUSE_NUMBER" # desired label value field name in the related table&amp;nbsp; &amp;nbsp; # As long as you want a simple single field stacked label you should not need to change this code &amp;nbsp; whereArgs = [arcpy.AddFieldDelimiters(featureClass, relatedFieldName), queryValue] &amp;nbsp; whereClause = "%s = %s" % tuple(whereArgs) &amp;nbsp; labelList = [] &amp;nbsp; rows = arcpy.da.SearchCursor(featureClass, (relatedFieldName, valueFieldName), whereClause) &amp;nbsp; for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp; labelList.append(row[1]) &amp;nbsp; labelList.sort() # uses correct sort order for numbers, dates or strings &amp;nbsp; labelList.insert(0, inputValue) # insert input value as a heading &amp;nbsp; return "\n".join(str(labelvalue) for labelvalue in labelList)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just as with the VB6 program, the labels take longer to build than labels based on fields from a single table.&amp;nbsp; Python has several advantages over VB6 or any other form of VB.&amp;nbsp; It can easily sort lists with correct sort orders for the value type contained in the list (numeric, date or string).&amp;nbsp; And the Python data access cursors are faster than the cursors used with VB6.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So this fundamental script can now be adapted to develop more sophisticated labels and multi-field labels.&amp;nbsp; There are several challenges to doing a label as complex as the one you want, so I first wanted to develop a proof of concept script before trying to tackle those challenges.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 14:36:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110342#M1353</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2013-09-11T14:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110343#M1354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is a screen shot of the output where the street name is labeled with all of the House Numbers that occurred on that street in numeric sorted order.&amp;nbsp; The labels are not optimized for prettiness or presentation.&amp;nbsp; They just demonstrate that the code above created labels that used the road name values from the displayed lines and matched them to the house numbers from a related table to generate a label.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Obviously there are better ways to present house numbers, such a min, max, count and average rather than labeling with the entire house number list, but that is formatting and not really relavant to the question about whether there is an alternative way to generate one-to-many relationship labels.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 19:02:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110343#M1354</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2013-09-11T19:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110344#M1355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That code works brilliantly and is a perfect start. Now I just need to figure out how to make the label a little more complicated rather than just stack lines. Going on work on figuring this out myself, but I will probably need your help if you are still willing. Thanks a lot for what you have already done.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 20:04:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110344#M1355</guid>
      <dc:creator>NaseefChowdhury</dc:creator>
      <dc:date>2013-09-11T20:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110345#M1356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Finally got it to work to look more like what I want, although running into a resource problem which is causing ArcMap to crash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code works, and does what I need it to do to display two fields instead of just the one&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
# variables that need to be customized for your specific data
def FindLabel ( [SampleName] ): # input the field name of the parent table's relate field
&amp;nbsp; inputValue = [SampleName] # repeat the parent table's relate field
&amp;nbsp; # define the data source path and fields of the related table
&amp;nbsp; featureClass = r'Chromium_Data'
&amp;nbsp; relatedFieldName = "sampleid" # the relate field name in the related table that corresponds to the input field
&amp;nbsp; valueFieldName = "depth" # desired label value field name in the related table
&amp;nbsp; valueFieldName2 = "result" # second field to label
&amp;nbsp; # As long as you want a simple single field stacked label you should not need to change this code
&amp;nbsp; whereArgs = [arcpy.AddFieldDelimiters(featureClass, relatedFieldName), "'" + inputValue + "'"]
&amp;nbsp; whereClause = "%s = %s" % tuple(whereArgs)
&amp;nbsp; labelList = []
&amp;nbsp; rows = arcpy.da.SearchCursor(featureClass, (relatedFieldName, valueFieldName, valueFieldName2), whereClause)
&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; finalString = (str(row[1]) + ": " + str(row[2])) # combining the label fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; labelList.append(finalString)
&amp;nbsp; labelList.sort() # uses correct sort order for numbers, dates or strings
&amp;nbsp; labelList.insert(0, inputValue) # insert input value as a heading
&amp;nbsp; return "\n".join(str(labelvalue) for labelvalue in labelList)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code theoretically works using 3 label fields, the code verification process displays the correct result, but the processing is too much and causes ArcMap to crash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
# variables that need to be customized for your specific data
def FindLabel ( [SampleName] ): # input the field name of the parent table's relate field
&amp;nbsp; inputValue = [SampleName] # repeat the parent table's relate field
&amp;nbsp; # define the data source path and fields of the related table
&amp;nbsp; featureClass = r'Chromium_Data'
&amp;nbsp; relatedFieldName = "sampleid" # the relate field name in the related table that corresponds to the input field
&amp;nbsp; valueFieldName = "param" # desired label value field name in the related table
&amp;nbsp; valueFieldName2 = "depth" # second field to label
&amp;nbsp; valueFieldName3 = "result" # third field to label
&amp;nbsp; # As long as you want a simple single field stacked label you should not need to change this code
&amp;nbsp; whereArgs = [arcpy.AddFieldDelimiters(featureClass, relatedFieldName), "'" + inputValue + "'"]
&amp;nbsp; whereClause = "%s = %s" % tuple(whereArgs)
&amp;nbsp; labelList = []
&amp;nbsp; rows = arcpy.da.SearchCursor(featureClass, (relatedFieldName, valueFieldName, valueFieldName2, valueFieldName3), whereClause)
&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; finalString = (str(row[1]) + " - " + str(row[2]) + " - " + str(row[3])) # combining the label fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; labelList.append(finalString)
&amp;nbsp; labelList.sort() # uses correct sort order for numbers, dates or strings
&amp;nbsp; labelList.insert(0, inputValue) # insert input value as a heading
&amp;nbsp; return "\n".join(str(labelvalue) for labelvalue in labelList)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It would be nice if ArcMap could handle this by itself, but I could work around it by pre-concatnating my 3 fields into one within the database. Of course editing the database is not an ideal solution, but at least we got a working solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Side question, do you know if there is a way to run a SQL statement within the code to filter the results, such as only displaying results where "valueFieldName3 = "desiredValue""?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:37:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110345#M1356</guid>
      <dc:creator>NaseefChowdhury</dc:creator>
      <dc:date>2021-12-11T06:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110346#M1357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Finally got it to work to look more like what I want, although running into a resource problem which is causing ArcMap to crash.&lt;BR /&gt;&lt;BR /&gt;This code works, and does what I need it to do to display two fields instead of just the one&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
# variables that need to be customized for your specific data
def FindLabel ( [SampleName] ): # input the field name of the parent table's relate field
&amp;nbsp; inputValue = [SampleName] # repeat the parent table's relate field
&amp;nbsp; # define the data source path and fields of the related table
&amp;nbsp; featureClass = r'Chromium_Data'
&amp;nbsp; relatedFieldName = "sampleid" # the relate field name in the related table that corresponds to the input field
&amp;nbsp; valueFieldName = "depth" # desired label value field name in the related table
&amp;nbsp; valueFieldName2 = "result" # second field to label
&amp;nbsp; # As long as you want a simple single field stacked label you should not need to change this code
&amp;nbsp; whereArgs = [arcpy.AddFieldDelimiters(featureClass, relatedFieldName), "'" + inputValue + "'"]
&amp;nbsp; whereClause = "%s = %s" % tuple(whereArgs)
&amp;nbsp; labelList = []
&amp;nbsp; rows = arcpy.da.SearchCursor(featureClass, (relatedFieldName, valueFieldName, valueFieldName2), whereClause)
&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; finalString = (str(row[1]) + ": " + str(row[2])) # combining the label fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; labelList.append(finalString)
&amp;nbsp; labelList.sort() # uses correct sort order for numbers, dates or strings
&amp;nbsp; labelList.insert(0, inputValue) # insert input value as a heading
&amp;nbsp; return "\n".join(str(labelvalue) for labelvalue in labelList)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;This code theoretically works using 3 label fields, the code verification process displays the correct result, but the processing is too much and causes ArcMap to crash.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
# variables that need to be customized for your specific data
def FindLabel ( [SampleName] ): # input the field name of the parent table's relate field
&amp;nbsp; inputValue = [SampleName] # repeat the parent table's relate field
&amp;nbsp; # define the data source path and fields of the related table
&amp;nbsp; featureClass = r'Chromium_Data'
&amp;nbsp; relatedFieldName = "sampleid" # the relate field name in the related table that corresponds to the input field
&amp;nbsp; valueFieldName = "param" # desired label value field name in the related table
&amp;nbsp; valueFieldName2 = "depth" # second field to label
&amp;nbsp; valueFieldName3 = "result" # third field to label
&amp;nbsp; # As long as you want a simple single field stacked label you should not need to change this code
&amp;nbsp; whereArgs = [arcpy.AddFieldDelimiters(featureClass, relatedFieldName), "'" + inputValue + "'"]
&amp;nbsp; whereClause = "%s = %s" % tuple(whereArgs)
&amp;nbsp; labelList = []
&amp;nbsp; rows = arcpy.da.SearchCursor(featureClass, (relatedFieldName, valueFieldName, valueFieldName2, valueFieldName3), whereClause)
&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; finalString = (str(row[1]) + " - " + str(row[2]) + " - " + str(row[3])) # combining the label fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; labelList.append(finalString)
&amp;nbsp; labelList.sort() # uses correct sort order for numbers, dates or strings
&amp;nbsp; labelList.insert(0, inputValue) # insert input value as a heading
&amp;nbsp; return "\n".join(str(labelvalue) for labelvalue in labelList)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;It would be nice if ArcMap could handle this by itself, but I could work around it by pre-concatnating my 3 fields into one within the database. Of course editing the database is not an ideal solution, but at least we got a working solution.&lt;BR /&gt;&lt;BR /&gt;Side question, do you know if there is a way to run a SQL statement within the code to filter the results, such as only displaying results where "valueFieldName3 = "desiredValue""?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am curious.&amp;nbsp; Did you try limiting the visible scale of the labels to see if that has any influence on ArcMap crashing or not?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not clear on what you mean in your last paragraph.&amp;nbsp; If there are two criteria field values in the parent table that give the desired value for field 3 then that would be a modification to the def to include 2 fields separated by commas and constructing a whereclause with an AND condition.&amp;nbsp; So it that what you want?&amp;nbsp; Or is the desired value hard coded, i.e. all values &amp;gt; 0?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;def FindLabel ( [SampleName], [SampleName3] &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; whereArgs = [arcpy.AddFieldDelimiters(featureClass, relatedFieldName), "'" + inputValue + "'", arcpy.AddFieldDelimiters(featureClass, valueFieldName3), "'" + [SampleName3] + "'"]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; whereClause = "%s = %s AND %s = %s" % tuple(whereArgs)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also probably you need to include del statements.&amp;nbsp; I.e.:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; del rows # delete cursor after building the list to free resources&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; labelList.sort() # uses correct sort order for numbers, dates or strings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; labelList.insert(0, inputValue) # insert input value as a heading&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; return "\n".join(str(labelvalue) for labelvalue in labelList)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:37:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110346#M1357</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T06:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110347#M1358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah, interesting, zooming in did take prevent the crash. Didn't think that would matter since the labels would have to be created anyway. I am still a little hesitant that it might crash the system anytime but it does work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the sql statement, I just wanted a data filter, which I worked around by putting it in the code with an if statement instead of using a sql clause&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[1] == "CHROMIUM": # data filter
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; finalString = (str(row[1]) + ": " + str(row[2]) + ": " + str(row[3])) # combining the label fields
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; labelList.append(finalString)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:37:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110347#M1358</guid>
      <dc:creator>NaseefChowdhury</dc:creator>
      <dc:date>2021-12-11T06:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110348#M1359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Ah, interesting, zooming in did take prevent the crash. Didn't think that would matter since the labels would have to be created anyway. I am still a little hesitant that it might crash the system anytime but it does work.&lt;BR /&gt;&lt;BR /&gt;For the sql statement, I just wanted a data filter, which I worked around by putting it in the code with an if statement instead of using a sql clause&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[1] == "CHROMIUM": # data filter
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; finalString = (str(row[1]) + ": " + str(row[2]) + ": " + str(row[3])) # combining the label fields
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; labelList.append(finalString)
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You are wrong.&amp;nbsp; It only processes labels on features in the visible extent, so the list is reduced by zooming in.&amp;nbsp; Also you want that filter in the SQL, since the number of rows returned affects the resources used.&amp;nbsp; But I think the real resource issue is that I did not include the del statements.&amp;nbsp; So add those and then zoom out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
# variables that need to be customized for your specific data
def FindLabel ( [SampleName] ): # input the field name of the parent table's relate field
&amp;nbsp; inputValue = [SampleName] # repeat the parent table's relate field
&amp;nbsp; # define the data source path and fields of the related table
&amp;nbsp; featureClass = r'Chromium_Data'
&amp;nbsp; relatedFieldName = "sampleid" # the relate field name in the related table that corresponds to the input field
&amp;nbsp; valueFieldName = "param" # desired label value field name in the related table
&amp;nbsp; valueFieldName2 = "depth" # second field to label
&amp;nbsp; valueFieldName3 = "result" # third field to label
&amp;nbsp; # As long as you want a simple single field stacked label you should not need to change this code
&amp;nbsp; whereArgs = [arcpy.AddFieldDelimiters(featureClass, relatedFieldName), "'" + inputValue + "'", arcpy.AddFieldDelimiters(featureClass, valueFieldName), "'CHROMIUM'"]
&amp;nbsp; whereClause = "%s = %s AND %s = %s" % tuple(whereArgs)
&amp;nbsp; labelList = []
&amp;nbsp; rows = arcpy.da.SearchCursor(featureClass, (relatedFieldName, valueFieldName, valueFieldName2, valueFieldName3), whereClause)
&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; finalString = (str(row[1]) + " - " + str(row[2]) + " - " + str(row[3])) # combining the label fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; del row
&amp;nbsp;&amp;nbsp;&amp;nbsp; labelList.append(finalString)
&amp;nbsp; del rows
&amp;nbsp; labelList.sort() # uses correct sort order for numbers, dates or strings
&amp;nbsp; labelList.insert(0, inputValue) # insert input value as a heading
&amp;nbsp; return "\n".join(str(labelvalue) for labelvalue in labelList)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:37:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110348#M1359</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T06:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110349#M1360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yeah I figured it was not good coding to put that if statement in there but it is what I could do with my limited knowledge &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the del is working well and it now loads all the labels fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is something wrong with your SQL statement though, that code returns an error and I only got it to work by removing the new data filter you added in. An error about not being able to convert all arguments during string converting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for all your efforts.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 23:51:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110349#M1360</guid>
      <dc:creator>NaseefChowdhury</dc:creator>
      <dc:date>2013-09-11T23:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110350#M1361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You should set a visible scale range limit on the label properties so that if you zoom out too far the labels will not be displayed.&amp;nbsp;&amp;nbsp; Also I zoomed out to see what would happen without a visible scale range after adding the del statements.&amp;nbsp; Here is the result at 2 different scale ranges to generate a large set of labels.&amp;nbsp; It took a long time to draw, especially for the second example, but it did not crash.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The error was my fault for not editing this line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; whereClause = "%s = %s" % tuple(whereArgs)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;it should be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; whereClause = "%s = %s AND %s = %s" % tuple(whereArgs)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 23:54:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110350#M1361</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2013-09-11T23:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110351#M1362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is the second shot just to show it could deal with a lot of labels.&amp;nbsp; Please assign points to my posts by pressing the up arrow on the right side of each post above the number.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 00:01:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110351#M1362</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2013-09-12T00:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110352#M1363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is some vbscript code I created to label using related (one-to-many) tables based on tips found here: &lt;/SPAN&gt;&lt;A href="http://www.esri.com/news/arcuser/1104/files/vbscript_label.pdf" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.esri.com/news/arcuser/1104/files/vbscript_label.pdf&lt;/A&gt;&lt;SPAN&gt; and here &lt;/SPAN&gt;&lt;A href="http://gisnuts.com/terra/blog/2012/05/16/label-features-with-attributes-from-related-records" rel="nofollow noopener noreferrer" target="_blank"&gt;http://gisnuts.com/terra/blog/2012/05/16/label-features-with-attributes-from-related-records&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You must change the items in italics to suit your datasets. My relate table happened to be a .csv file. &lt;/SPAN&gt;&lt;STRONG&gt;And I used a font (Lucida Console) in which every character is exactly the same width so that my numbers (see pic) would line up on the right.&lt;/STRONG&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel ( [&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;RelateField&lt;/STRONG&gt;&lt;/SPAN&gt;] )
&amp;nbsp; iMaxLbl1Sz = 0
&amp;nbsp; iMaxLbl2Sz = 0
&amp;nbsp; iSpace = 3
&amp;nbsp; Set gp = CreateObject("esriGeoprocessing.GPDispatch.1")
&amp;nbsp; strWhereClause = chr(34) &amp;amp; "&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;RelateFieldinTable&lt;/STRONG&gt;&lt;/SPAN&gt;" &amp;amp; chr(34) &amp;amp; " = '" &amp;amp; [&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;RelateField&lt;/STRONG&gt;&lt;/SPAN&gt;] &amp;amp; "'" 
&amp;nbsp; strpTable = "&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;path to your relate table&lt;/STRONG&gt;&lt;/SPAN&gt;"
&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.Depths
&amp;nbsp; strLabel2 = prow.TotalPAHs
&amp;nbsp; If (Len(strLabel1) &amp;gt; iMaxLbl1Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl1Sz = Len(strLabel1)
&amp;nbsp; End If
&amp;nbsp; If (Len(strLabel2) &amp;gt; iMaxLbl2Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl2Sz = Len(strLabel2)
&amp;nbsp; End If
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop&amp;nbsp; FindLabel = "&amp;lt;UND&amp;gt;" &amp;amp; FindLabel &amp;amp; [&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;RelateField&lt;/STRONG&gt;&lt;/SPAN&gt;] &amp;amp; "&amp;lt;/UND&amp;gt;" &amp;amp; vbnewline
&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.Depths
&amp;nbsp; strLabel2 = prow.TotalPAHs
&amp;nbsp; k = (iMaxLbl1Sz - Len(strLabel1)) + iSpace + (iMaxLbl2Sz - Len(strLabel2))
&amp;nbsp; FindLabel = FindLabel &amp;amp; strLabel1 &amp;amp; String(k, ".") &amp;amp; strLabel2 &amp;amp; vbnewline
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
End Function&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:37:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110352#M1363</guid>
      <dc:creator>JenniferHorsman2</dc:creator>
      <dc:date>2021-12-11T06:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110353#M1364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is another example that looks even more like a table. The text in &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;bold italics&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; must be modified to suit your data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]29762[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Again, I used a .csv file as my relate table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel ( [&lt;STRONG style="font-style: italic;"&gt;RelateFieldOfLayer&lt;/STRONG&gt;] )
&amp;nbsp; iMaxLbl1Sz = 0
&amp;nbsp; iMaxLbl2Sz = 0
&amp;nbsp; iSpace = 5
&amp;nbsp; Set gp = CreateObject("esriGeoprocessing.GPDispatch.1")
&amp;nbsp; strWhereClause = chr(34) &amp;amp; "&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;RelateFieldOfTable&lt;/STRONG&gt;&lt;/SPAN&gt;" &amp;amp; chr(34) &amp;amp; " = '" &amp;amp; [&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;RelateFieldOfLayer&lt;/STRONG&gt;&lt;/SPAN&gt;] &amp;amp; "'" 
&amp;nbsp; strpTable = "&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;PathToRelateTable&lt;/STRONG&gt;&lt;/SPAN&gt;"

&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.&lt;STRONG style="font-style: italic;"&gt;LabelField1&lt;/STRONG&gt;
&amp;nbsp; strLabel2 = prow.&lt;STRONG style="font-style: italic;"&gt;LabelField2&lt;/STRONG&gt;
&amp;nbsp; If (Len(strLabel1) &amp;gt; iMaxLbl1Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl1Sz = Len(strLabel1)
&amp;nbsp; End If
&amp;nbsp; If (Len(strLabel2) &amp;gt; iMaxLbl2Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl2Sz = Len(strLabel2)
&amp;nbsp; End If
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop

&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;FNT name='Arial' size='6.25'&amp;gt;" &amp;amp; [&lt;STRONG style="font-style: italic;"&gt;RelateFieldOfLayer&lt;/STRONG&gt;] &amp;amp; "&amp;lt;/FNT&amp;gt;" &amp;amp; vbnewline
&amp;nbsp; FindLabel = FindLabel &amp;amp; String(iMaxLbl1Sz + iMaxLbl2Sz + iSpace, "_") &amp;amp; vbnewline
&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.&lt;STRONG style="font-style: italic;"&gt;LabelField1&lt;/STRONG&gt;
&amp;nbsp; strLabel2 = prow.&lt;STRONG style="font-style: italic;"&gt;LabelField2&lt;/STRONG&gt;
&amp;nbsp; k1 = (iMaxLbl1Sz - Len(strLabel1)) + 2
&amp;nbsp; k2 = iSpace + (iMaxLbl2Sz - Len(strLabel2)) - 3
&amp;nbsp; FindLabel = FindLabel &amp;amp; strLabel1 &amp;amp; "&amp;lt;CLR red='255' green='255' blue='255'&amp;gt;" &amp;amp; String(k1, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "|"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;CLR red='255' green='255' blue='255'&amp;gt;" &amp;amp; String(k2, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;" &amp;amp; strLabel2 &amp;amp; vbnewline
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
End Function&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:37:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110353#M1364</guid>
      <dc:creator>JenniferHorsman2</dc:creator>
      <dc:date>2021-12-11T06:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110354#M1365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jennifer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the code. I have modified it slightly to make it slightly easier to change the inputs of the script that need to be customized for user specific data by adding variables in the top lines of the Function. The field names still have to be modified in the body of the text. The inputs are shown in Red, Bold and Italics similar in your code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also modified the label style created by the code by eliminating the horizontal line inserted below the table header by using an underline of the header instead to reduce the amount of vertical space needed for each label. As you mentioned, the label font needs to have uniform spaced characters to work correctly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel ( [&lt;STRONG&gt;RelateFieldOfLayer&lt;/STRONG&gt;] )
&amp;nbsp; RelateFieldOfLayerValues = [&lt;STRONG&gt;RelateFieldOfLayer&lt;/STRONG&gt;]
&amp;nbsp; RelateFieldOfLayer = "&lt;STRONG&gt;RelateFieldOfLayer&lt;/STRONG&gt;"
&amp;nbsp; RelateFieldOfTable = "&lt;STRONG&gt;RelateFieldOfTable&lt;/STRONG&gt;"
&amp;nbsp; strpTable = "&lt;STRONG&gt;PathToRelateTable&lt;/STRONG&gt;"
&amp;nbsp; iMaxLbl1Sz = 0
&amp;nbsp; iMaxLbl2Sz = 0
&amp;nbsp; iSpace = 5
&amp;nbsp; Set gp = CreateObject("esriGeoprocessing.GPDispatch.1")
&amp;nbsp; strWhereClause = chr(34) &amp;amp; RelateFieldOfTable &amp;amp; chr(34) &amp;amp; " = '" &amp;amp; RelateFieldOfLayerValues &amp;amp; "'" 

&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.&lt;STRONG&gt;LabelField1&lt;/STRONG&gt;
&amp;nbsp; strLabel2 = prow.&lt;STRONG&gt;LabelField2&lt;/STRONG&gt;
&amp;nbsp; If (Len(strLabel1) &amp;gt; iMaxLbl1Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl1Sz = Len(strLabel1)
&amp;nbsp; End If
&amp;nbsp; If (Len(strLabel2) &amp;gt; iMaxLbl2Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl2Sz = Len(strLabel2)
&amp;nbsp; End If
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
&amp;nbsp; Set prows = Nothing

&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;UND&amp;gt;" &amp;amp; RelateFieldOfLayerValues &amp;amp; "&amp;lt;/UND&amp;gt;" &amp;amp; String(iMaxLbl1Sz + iMaxLbl2Sz + iSpace - Len(RelateFieldOfLayerValues), "_") &amp;amp; vbnewline
&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.&lt;STRONG&gt;LabelField1&lt;/STRONG&gt;
&amp;nbsp; strLabel2 = prow.&lt;STRONG&gt;LabelField2&lt;/STRONG&gt;
&amp;nbsp; k1 = (iMaxLbl1Sz - Len(strLabel1)) + 2
&amp;nbsp; k2 = iSpace + (iMaxLbl2Sz - Len(strLabel2)) - 3
&amp;nbsp; FindLabel = FindLabel &amp;amp; strLabel1 &amp;amp; "&amp;lt;CLR red='255' green='255' blue='255'&amp;gt;" &amp;amp; String(k1, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "|"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;CLR red='255' green='255' blue='255'&amp;gt;" &amp;amp; String(k2, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;" &amp;amp; strLabel2 &amp;amp; vbnewline
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
&amp;nbsp; Set prows = Nothing
End Function&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:01:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110354#M1365</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-12T16:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110355#M1366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How would the "where" in string type primary keys?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Jennifer:&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;Thanks for the code. I have modified it slightly to make it slightly easier to change the inputs of the script that need to be customized for user specific data by adding variables in the top lines of the Function. The field names still have to be modified in the body of the text. The inputs are shown in Red, Bold and Italics similar in your code.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;I also modified the label style created by the code by eliminating the horizontal line inserted below the table header by using an underline of the header instead to reduce the amount of vertical space needed for each label. As you mentioned, the label font needs to have uniform spaced characters to work correctly.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel ( [&lt;STRONG style=": ; color: &amp;quot;#FF0000&amp;quot;; font-style: italic;"&gt;RelateFieldOfLayer&lt;/STRONG&gt;] )
&amp;nbsp; RelateFieldOfLayerValues = [&lt;STRONG style=": ; color: &amp;quot;#FF0000&amp;quot;; font-style: italic;"&gt;RelateFieldOfLayer&lt;/STRONG&gt;]
&amp;nbsp; RelateFieldOfLayer = "&lt;STRONG style=": ; color: &amp;quot;#FF0000&amp;quot;; font-style: italic;"&gt;RelateFieldOfLayer&lt;/STRONG&gt;"
&amp;nbsp; RelateFieldOfTable = "&lt;STRONG style=": ; color: &amp;quot;#FF0000&amp;quot;; font-style: italic;"&gt;RelateFieldOfTable&lt;/STRONG&gt;"
&amp;nbsp; strpTable = "&lt;STRONG style=": ; color: &amp;quot;#FF0000&amp;quot;; font-style: italic;"&gt;PathToRelateTable&lt;/STRONG&gt;"
&amp;nbsp; iMaxLbl1Sz = 0
&amp;nbsp; iMaxLbl2Sz = 0
&amp;nbsp; iSpace = 5
&amp;nbsp; Set gp = CreateObject("esriGeoprocessing.GPDispatch.1")
&amp;nbsp; strWhereClause = chr(34) &amp;amp; RelateFieldOfTable &amp;amp; chr(34) &amp;amp; " = '" &amp;amp; RelateFieldOfLayerValues &amp;amp; "'" 

&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.&lt;STRONG style=": ; color: &amp;quot;#FF0000&amp;quot;; font-style: italic;"&gt;LabelField1&lt;/STRONG&gt;
&amp;nbsp; strLabel2 = prow.&lt;STRONG style=": ; color: &amp;quot;#FF0000&amp;quot;; font-style: italic;"&gt;LabelField2&lt;/STRONG&gt;
&amp;nbsp; If (Len(strLabel1) &amp;gt; iMaxLbl1Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl1Sz = Len(strLabel1)
&amp;nbsp; End If
&amp;nbsp; If (Len(strLabel2) &amp;gt; iMaxLbl2Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl2Sz = Len(strLabel2)
&amp;nbsp; End If
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
&amp;nbsp; Set prows = Nothing

&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;UND&amp;gt;" &amp;amp; RelateFieldOfLayerValues &amp;amp; "&amp;lt;/UND&amp;gt;" &amp;amp; String(iMaxLbl1Sz + iMaxLbl2Sz + iSpace - Len(RelateFieldOfLayerValues), "_") &amp;amp; vbnewline
&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.&lt;STRONG style=": ; color: &amp;quot;#FF0000&amp;quot;; font-style: italic;"&gt;LabelField1&lt;/STRONG&gt;
&amp;nbsp; strLabel2 = prow.&lt;STRONG style=": ; color: &amp;quot;#FF0000&amp;quot;; font-style: italic;"&gt;LabelField2&lt;/STRONG&gt;
&amp;nbsp; k1 = (iMaxLbl1Sz - Len(strLabel1)) + 2
&amp;nbsp; k2 = iSpace + (iMaxLbl2Sz - Len(strLabel2)) - 3
&amp;nbsp; FindLabel = FindLabel &amp;amp; strLabel1 &amp;amp; "&amp;lt;CLR red='255' green='255' blue='255'&amp;gt;" &amp;amp; String(k1, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "|"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;CLR red='255' green='255' blue='255'&amp;gt;" &amp;amp; String(k2, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;" &amp;amp; strLabel2 &amp;amp; vbnewline
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
&amp;nbsp; Set prows = Nothing
End Function&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:37:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110355#M1366</guid>
      <dc:creator>JoymaxNascimento</dc:creator>
      <dc:date>2021-12-11T06:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110356#M1367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;How would the "where" in string type primary keys?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The code assumed the related field was a string field, because single quotes are surrounding the value in the where clause variable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strWhereClause = chr(34) &amp;amp; RelateFieldOfTable &amp;amp; chr(34) &amp;amp; " = '" &amp;amp; RelateFieldOfLayerValues &amp;amp; "'" &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the relate field was actually a numeric field the code would have to be changed to remove the single quotes from the line of code that builds the where clause.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strWhereClause = chr(34) &amp;amp; RelateFieldOfTable &amp;amp; chr(34) &amp;amp; " = " &amp;amp; RelateFieldOfLayerValues&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this does not answer your question, please copy the specific lines of code into your message that you are concerned about to better help me understand your question.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 15:36:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110356#M1367</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-05-14T15:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110357#M1368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In my case, just does not work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Unable enteder why.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Function FindLabel ( [HOLEID] )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; RelateFieldOfLayerValues = [HOLEID]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; RelateFieldOfLayer = "HOLEID"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; RelateFieldOfTable = "HOLEID"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strpTable = "A:\Desktop\New Folder\New Folder\BNDS.mdb\TEOR"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;iMaxLbl1Sz = 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; iMaxLbl2Sz = 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; iSpace = 8&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set gp = CreateObject("esriGeoprocessing.GPDispatch.1")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;strWhereClause = chr(34) &amp;amp; RelateFieldOfTable &amp;amp; chr(34) &amp;amp; " = '" &amp;amp; RelateFieldOfLayerValues &amp;amp; "'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set prow = prows.next&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Do until prow is nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strLabel1 = prow.[HOLEID]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strLabel2 = prow.[ATE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; If (Len(strLabel1) &amp;gt; iMaxLbl1Sz) Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl1Sz = Len(strLabel1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; If (Len(strLabel2) &amp;gt; iMaxLbl2Sz) Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl2Sz = Len(strLabel2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set prow = prows.next&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set prows = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;UND&amp;gt;" &amp;amp; RelateFieldOfLayerValues &amp;amp; "&amp;lt;/UND&amp;gt;" &amp;amp; String(iMaxLbl1Sz + iMaxLbl2Sz + iSpace - Len(RelateFieldOfLayerValues), "_") &amp;amp; vbnewline&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set prow = prows.next&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Do until prow is nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strLabel1 = prow.[HOLEID]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strLabel2 = prow.[GEO]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; k1 = (iMaxLbl1Sz - Len(strLabel1)) + 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; k2 = iSpace + (iMaxLbl2Sz - Len(strLabel2)) - 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; FindLabel = FindLabel &amp;amp; strLabel1 &amp;amp; "&amp;lt;CLR red='0' green='0' blue='0'&amp;gt;" &amp;amp; String(k1, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; FindLabel = FindLabel &amp;amp; "|"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;CLR red='0' green='0' blue='0'&amp;gt;" &amp;amp; String(k2, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;" &amp;amp; strLabel2 &amp;amp; vbnewline&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set prow = prows.next&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Set prows = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Function&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just returned is the [HOLEID].[ATTACH=CONFIG]33821[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]0[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The code assumed the related field was a string field, because single quotes are surrounding the value in the where clause variable.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; strWhereClause = chr(34) &amp;amp; RelateFieldOfTable &amp;amp; chr(34) &amp;amp; " = '" &amp;amp; RelateFieldOfLayerValues &amp;amp; "'" &lt;BR /&gt;&lt;BR /&gt;If the relate field was actually a numeric field the code would have to be changed to remove the single quotes from the line of code that builds the where clause.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; strWhereClause = chr(34) &amp;amp; RelateFieldOfTable &amp;amp; chr(34) &amp;amp; " = " &amp;amp; RelateFieldOfLayerValues&lt;BR /&gt;&lt;BR /&gt;If this does not answer your question, please copy the specific lines of code into your message that you are concerned about to better help me understand your question.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 16:25:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110357#M1368</guid>
      <dc:creator>JoymaxNascimento</dc:creator>
      <dc:date>2014-05-14T16:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110358#M1369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The field names for the cursor are not supposed to be surrounded by brackets.&amp;nbsp; (I would have put brackets in my example around the red text if I meant for you to enter a field name within brackets for the lines of code below)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Change this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strLabel1 = prow.[HOLEID]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strLabel2 = prow.[ATE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strLabel1 = prow.HOLEID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strLabel2 = prow.ATE&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Both sets of these lines of code have to be identical.&amp;nbsp; You have to use ATE or both have to use GEO for the second field.&amp;nbsp; Or else both sets could be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strLabel1 = prow.ATE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strLabel2 = prow.GEO&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;HoleID will be included in the header line built by this line of code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;UND&amp;gt;" &amp;amp; RelateFieldOfLayerValues &amp;amp; "&amp;lt;/UND&amp;gt;" &amp;amp; String(iMaxLbl1Sz + iMaxLbl2Sz + iSpace - Len(RelateFieldOfLayerValues), "_") &amp;amp; vbnewline&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;HOLEID should be a text field to work with this where clause and should not have Null values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel ( [HOLEID] )
&amp;nbsp; RelateFieldOfLayerValues = [HOLEID]
&amp;nbsp; RelateFieldOfLayer = "HOLEID"
&amp;nbsp; RelateFieldOfTable = "HOLEID"
&amp;nbsp; strpTable = "A:\Desktop\New Folder\New Folder\BNDS.mdb\TEOR"
iMaxLbl1Sz = 10
&amp;nbsp; iMaxLbl2Sz = 0
&amp;nbsp; iSpace = 8
&amp;nbsp; Set gp = CreateObject("esriGeoprocessing.GPDispatch.1")
strWhereClause = chr(34) &amp;amp; RelateFieldOfTable &amp;amp; chr(34) &amp;amp; " = '" &amp;amp; RelateFieldOfLayerValues &amp;amp; "'"

&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.ATE
&amp;nbsp; strLabel2 = prow.GEO
&amp;nbsp; If (Len(strLabel1) &amp;gt; iMaxLbl1Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl1Sz = Len(strLabel1)
&amp;nbsp; End If
&amp;nbsp; If (Len(strLabel2) &amp;gt; iMaxLbl2Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl2Sz = Len(strLabel2)
&amp;nbsp; End If
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
&amp;nbsp; Set prows = Nothing

&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;UND&amp;gt;" &amp;amp; RelateFieldOfLayerValues &amp;amp; "&amp;lt;/UND&amp;gt;" &amp;amp; String(iMaxLbl1Sz + iMaxLbl2Sz + iSpace - Len(RelateFieldOfLayerValues), "_") &amp;amp; vbnewline
&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.ATE
&amp;nbsp; strLabel2 = prow.GEO
&amp;nbsp; k1 = (iMaxLbl1Sz - Len(strLabel1)) + 2
&amp;nbsp; k2 = iSpace + (iMaxLbl2Sz - Len(strLabel2)) - 3
&amp;nbsp; FindLabel = FindLabel &amp;amp; strLabel1 &amp;amp; "&amp;lt;CLR red='0' green='0' blue='0'&amp;gt;" &amp;amp; String(k1, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "|"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;CLR red='0' green='0' blue='0'&amp;gt;" &amp;amp; String(k2, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;" &amp;amp; strLabel2 &amp;amp; vbnewline
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
&amp;nbsp; Set prows = Nothing
End Function&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:37:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110358#M1369</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T06:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110359#M1370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It did not work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is to write the "where" directly?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The field names for the cursor are not supposed to be surrounded by brackets.&amp;nbsp; (I would have put brackets in my example around the red text if I meant for you to enter a field name within brackets for the lines of code below)&lt;BR /&gt;&lt;BR /&gt;Change this:&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; strLabel1 = prow.[HOLEID]&lt;BR /&gt;&amp;nbsp; strLabel2 = prow.[ATE]&lt;BR /&gt; &lt;BR /&gt;to this:&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; strLabel1 = prow.HOLEID&lt;BR /&gt;&amp;nbsp; strLabel2 = prow.ATE&lt;BR /&gt;&lt;BR /&gt;HOLEID should be a text field to work with this where clause and should not have Null values.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel ( [HOLEID] )
&amp;nbsp; RelateFieldOfLayerValues = [HOLEID]
&amp;nbsp; RelateFieldOfLayer = "HOLEID"
&amp;nbsp; RelateFieldOfTable = "HOLEID"
&amp;nbsp; strpTable = "A:\Desktop\New Folder\New Folder\BNDS.mdb\TEOR"
iMaxLbl1Sz = 10
&amp;nbsp; iMaxLbl2Sz = 0
&amp;nbsp; iSpace = 8
&amp;nbsp; Set gp = CreateObject("esriGeoprocessing.GPDispatch.1")
strWhereClause = chr(34) &amp;amp; RelateFieldOfTable &amp;amp; chr(34) &amp;amp; " = '" &amp;amp; RelateFieldOfLayerValues &amp;amp; "'"

&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.HOLEID
&amp;nbsp; strLabel2 = prow.ATE
&amp;nbsp; If (Len(strLabel1) &amp;gt; iMaxLbl1Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl1Sz = Len(strLabel1)
&amp;nbsp; End If
&amp;nbsp; If (Len(strLabel2) &amp;gt; iMaxLbl2Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl2Sz = Len(strLabel2)
&amp;nbsp; End If
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
&amp;nbsp; Set prows = Nothing

&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;UND&amp;gt;" &amp;amp; RelateFieldOfLayerValues &amp;amp; "&amp;lt;/UND&amp;gt;" &amp;amp; String(iMaxLbl1Sz + iMaxLbl2Sz + iSpace - Len(RelateFieldOfLayerValues), "_") &amp;amp; vbnewline
&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.HOLEID
&amp;nbsp; strLabel2 = prow.GEO
&amp;nbsp; k1 = (iMaxLbl1Sz - Len(strLabel1)) + 2
&amp;nbsp; k2 = iSpace + (iMaxLbl2Sz - Len(strLabel2)) - 3
&amp;nbsp; FindLabel = FindLabel &amp;amp; strLabel1 &amp;amp; "&amp;lt;CLR red='0' green='0' blue='0'&amp;gt;" &amp;amp; String(k1, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "|"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;CLR red='0' green='0' blue='0'&amp;gt;" &amp;amp; String(k2, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;" &amp;amp; strLabel2 &amp;amp; vbnewline
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
&amp;nbsp; Set prows = Nothing
End Function&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:38:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110359#M1370</guid>
      <dc:creator>JoymaxNascimento</dc:creator>
      <dc:date>2021-12-11T06:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: One to many labeling</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110360#M1371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;It did not work. &lt;BR /&gt;Is to write the "where" directly?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You have no basis for thinking the "where" is the problem.&amp;nbsp; The code works when the inputs are correct, otherwise I could not have made the screenshot.&amp;nbsp; The only problems are tied to the inputs you are supplying.&amp;nbsp; Your path is likely the problem.&amp;nbsp; The backslash is an escape character and not being interpreted as a backslash.&amp;nbsp; You must make it a raw string to correct that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strpTable = r"A:\Desktop\New Folder\New Folder\BNDS.mdb\TEOR"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can reference a table that is already in your map without using any path and it will work.&amp;nbsp; So add TEOR to the map and make the path:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; strpTable = "TEOR"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You also did not make the two sets of field pairs identical.&amp;nbsp; That is corrected below where I assumed you wanted ATE and GEO listed as paired values under the HOLEID header.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Function FindLabel ( [HOLEID] )
&amp;nbsp; RelateFieldOfLayerValues = [HOLEID]
&amp;nbsp; RelateFieldOfLayer = "HOLEID"
&amp;nbsp; RelateFieldOfTable = "HOLEID"
&amp;nbsp; strpTable = r"A:\Desktop\New Folder\New Folder\BNDS.mdb\TEOR"
iMaxLbl1Sz = 10
&amp;nbsp; iMaxLbl2Sz = 0
&amp;nbsp; iSpace = 8
&amp;nbsp; Set gp = CreateObject("esriGeoprocessing.GPDispatch.1")
strWhereClause = chr(34) &amp;amp; RelateFieldOfTable &amp;amp; chr(34) &amp;amp; " = '" &amp;amp; RelateFieldOfLayerValues &amp;amp; "'"

&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.ATE
&amp;nbsp; strLabel2 = prow.GEO
&amp;nbsp; If (Len(strLabel1) &amp;gt; iMaxLbl1Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl1Sz = Len(strLabel1)
&amp;nbsp; End If
&amp;nbsp; If (Len(strLabel2) &amp;gt; iMaxLbl2Sz) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; iMaxLbl2Sz = Len(strLabel2)
&amp;nbsp; End If
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
&amp;nbsp; Set prows = Nothing

&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;UND&amp;gt;" &amp;amp; RelateFieldOfLayerValues &amp;amp; "&amp;lt;/UND&amp;gt;" &amp;amp; String(iMaxLbl1Sz + iMaxLbl2Sz + iSpace - Len(RelateFieldOfLayerValues), "_") &amp;amp; vbnewline
&amp;nbsp; Set prows = gp.searchcursor(strpTable,strWhereClause)
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Do until prow is nothing
&amp;nbsp; strLabel1 = prow.ATE
&amp;nbsp; strLabel2 = prow.GEO
&amp;nbsp; k1 = (iMaxLbl1Sz - Len(strLabel1)) + 2
&amp;nbsp; k2 = iSpace + (iMaxLbl2Sz - Len(strLabel2)) - 3
&amp;nbsp; FindLabel = FindLabel &amp;amp; strLabel1 &amp;amp; "&amp;lt;CLR red='0' green='0' blue='0'&amp;gt;" &amp;amp; String(k1, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "|"
&amp;nbsp; FindLabel = FindLabel &amp;amp; "&amp;lt;CLR red='0' green='0' blue='0'&amp;gt;" &amp;amp; String(k2, ".") &amp;amp; "&amp;lt;/CLR&amp;gt;" &amp;amp; strLabel2 &amp;amp; vbnewline
&amp;nbsp; Set prow = prows.next
&amp;nbsp; Loop
&amp;nbsp; Set prows = Nothing
End Function&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:38:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/one-to-many-labeling/m-p/110360#M1371</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T06:38:02Z</dc:date>
    </item>
  </channel>
</rss>

