<?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: Label Expression (VBS) in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014756#M35772</link>
    <description>&lt;P&gt;Thanks so much for that, &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;. Unfortunately, I think I am doing something wrong. I changed the language to Python, but it is giving me this message:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invalid Expression&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; &amp;nbsp;File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;File "&amp;lt;string&amp;gt;", line 5, in FindLabel&lt;BR /&gt;TypeError: must be str, not NoneType&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jan 2021 18:00:37 GMT</pubDate>
    <dc:creator>Lauren-H</dc:creator>
    <dc:date>2021-01-07T18:00:37Z</dc:date>
    <item>
      <title>Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014415#M35736</link>
      <description>&lt;P&gt;I am trying to add a line to an existing script. I have created a new attribute field [PlantDate], and need it to reflect in the label expression.&lt;/P&gt;&lt;P&gt;This is the current script:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Function FindLabel ( [FieldName], [FarmAcres], [FutureCrop1], [FutureCrop2], [FutureCrop3], [IrrigationType] )

      If (IsNull ([FutureCrop2])  AND IsNull ([FutureCrop3])) Then

              FindLabel = "Field #" + [FieldName]  &amp;amp; vbCrLf &amp;amp; [FarmAcres]  + " Acres"   &amp;amp; vbCrLf&amp;amp; [FutureCrop1]  &amp;amp; vbCrLf&amp;amp; [IrrigationType]

   ElseIf IsNull ([FutureCrop3]) Then

               FindLabel = "Field #" + [FieldName]  &amp;amp; vbCrLf &amp;amp; [FarmAcres]  + " Acres"   &amp;amp; vbCrLf&amp;amp; [FutureCrop1] + "/ " + [FutureCrop2]  &amp;amp; vbCrLf&amp;amp; [IrrigationType]

   Else

               FindLabel = "Field #" + [FieldName]  &amp;amp; vbCrLf &amp;amp; [FarmAcres]  + " Acres"   &amp;amp; vbCrLf&amp;amp; [FutureCrop1] + "/ " + [FutureCrop2] + "/ " + [FutureCrop3]  &amp;amp; vbCrLf&amp;amp; [IrrigationType]

   End If

End Function&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;I need it to include the new "plant date" field [PlantDate] on the next line. I did the following script but it is only showing the features of the original script so I am unsure what I am doing wrong (note: the field is not &amp;lt;null&amp;gt;, I have a value in the field for this polygon). This is the script I tried:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Function FindLabel ( [FieldName], [FarmAcres], [FutureCrop1], [FutureCrop2], [FutureCrop3], [IrrigationType], [PlantDate] )
      If (IsNull ([FutureCrop2])  AND IsNull ([FutureCrop3])) Then
              FindLabel = "Field #" + [FieldName]  &amp;amp; vbCrLf &amp;amp; [FarmAcres]  + " Acres"   &amp;amp; vbCrLf&amp;amp; [FutureCrop1]  &amp;amp; vbCrLf&amp;amp; [IrrigationType] &amp;amp; vbCrLf&amp;amp; [PlantDate]
   ElseIf IsNull ([FutureCrop3]) Then
               FindLabel = "Field #" + [FieldName]  &amp;amp; vbCrLf &amp;amp; [FarmAcres]  + " Acres"   &amp;amp; vbCrLf&amp;amp; [FutureCrop1] + "/ " + [FutureCrop2]  &amp;amp; vbCrLf&amp;amp; [IrrigationType] &amp;amp; vbCrLf&amp;amp; [PlantDate] 
   Else
               FindLabel = "Field #" + [FieldName]  &amp;amp; vbCrLf &amp;amp; [FarmAcres]  + " Acres"   &amp;amp; vbCrLf&amp;amp; [FutureCrop1] + "/ " + [FutureCrop2] + "/ " + [FutureCrop3]  &amp;amp; vbCrLf&amp;amp; [IrrigationType] &amp;amp; vbCrLf&amp;amp; [PlantDate]
   End If
End Function&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;The system says it is valid, but it is not showing that added [PlantDate] information on the polygon. Refreshing and reloading is not correcting it either.&amp;nbsp; Ideally, I would like it to have the text "Plant Date" following the value (like I have ' + " Acres" ' for field acres) but it says there is an error when I attempt, and it blues out the word "date."&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any help/advice would be great appreciated! Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 20:12:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014415#M35736</guid>
      <dc:creator>Lauren-H</dc:creator>
      <dc:date>2021-01-06T20:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014453#M35740</link>
      <description>&lt;P&gt;Are you happy doing it in Python? My VBA knowledge is non existent! (although not sure that + is being used in the right way instead of &amp;amp;?, also is that the right fieldname and not an alias?)&lt;/P&gt;&lt;P&gt;If so, can you just give some pseudo code or example of the intended output.&lt;/P&gt;&lt;P&gt;Hopefully a VBA ninja can help you out though.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 21:39:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014453#M35740</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-06T21:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014459#M35743</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;, my vb script skills are about the same as yours.&amp;nbsp; I &lt;EM&gt;think&lt;/EM&gt; the plus sign is being used to join the strings in quotes with the value of the field in square brackets.&amp;nbsp; The ampersand concatenates expressions and Vbcrlf is a carriage return. Vbnewline is what I used to use.&lt;/P&gt;&lt;P&gt;I agree though, Python is going to be around longer than any of the vb flavours and&amp;nbsp; suggest taking that route. Label expressions are a great way to get started.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 21:54:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014459#M35743</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-01-06T21:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014460#M35744</link>
      <description>&lt;P&gt;So as far as I'm aware, the + is to add the text to the end, otherwise it would just show the value. i.e. if the value for [FarmAcres] is 84, it would show only 84. But with the " + Acres" it adds the text "Acres" to show "84 Acres" instead.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;So the intended output is this (with the line breaks):&lt;/P&gt;&lt;P&gt;Field# [FieldName]&lt;BR /&gt;[Farm Acres] Acres&lt;BR /&gt;[FutureCrop1]&lt;BR /&gt;[Irrigation Type]&lt;BR /&gt;[PlantDate]&lt;/P&gt;&lt;P&gt;So if values on a particular polygon feature is completed it would look like this:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Field #2&lt;BR /&gt;84 Acres&lt;BR /&gt;Walnuts&lt;BR /&gt;Micro Irrigation Sprinkler&lt;BR /&gt;2018&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(and then obviously, we have the conditions in there that if there are values in [FutureCrop2] or [FutureCrop3] that it will display those if applicable.)&lt;BR /&gt;&lt;BR /&gt;I'm not against changing to Python as I am not versed in VBA either, but I'm also not versed in Python... I am very much a novice in all things ArcGIS. But if Python is easier to use/learn, I could look into it.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The alias and field name are the same, so I'm not sure if I did that correctly, but that has worked for me in the past.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your response! I hope I answered all your questions adequately.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2021 21:55:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014460#M35744</guid>
      <dc:creator>Lauren-H</dc:creator>
      <dc:date>2021-01-06T21:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014632#M35762</link>
      <description>&lt;P&gt;this should do it:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel([FieldName], [FarmAcres], [FutureCrop1], [FutureCrop2], [FutureCrop3], [IrrigationType], [PlantDate]):
    

    if [FutureCrop2] is None and [FutureCrop3] is None:
        result = "Field #" + [FieldName] + "\n" + str([FarmAcres]) + " Acres" + "\n" + [FutureCrop1] + "\n" + [IrrigationType] + "\n" + str([PlantDate])

    elif [FutureCrop3] is None:
        result = "Field #" + [FieldName] + "\n" + str([FarmAcres]) + " Acres" + "\n" + [FutureCrop1] + "/" + [FutureCrop2] + "\n" + [IrrigationType] + "\n" + str([PlantDate])

    else:
        result = "Field #" + [FieldName] + "\n" + str([FarmAcres]) + " Acres" + "\n" + [FutureCrop1] + "/" + [FutureCrop2] + "/" + [FutureCrop3] + "\n" + [IrrigationType] + "\n" + str([PlantDate])


    return result
        &lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Jan 2021 14:48:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014632#M35762</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-07T14:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014756#M35772</link>
      <description>&lt;P&gt;Thanks so much for that, &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;. Unfortunately, I think I am doing something wrong. I changed the language to Python, but it is giving me this message:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invalid Expression&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; &amp;nbsp;File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;File "&amp;lt;string&amp;gt;", line 5, in FindLabel&lt;BR /&gt;TypeError: must be str, not NoneType&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 18:00:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014756#M35772</guid>
      <dc:creator>Lauren-H</dc:creator>
      <dc:date>2021-01-07T18:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014799#M35773</link>
      <description>&lt;P&gt;It's, likely the case that any of FieldName, FarmAcres and PlantDate are NULL/None type values, which are trying to be concatenated and failing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There's many ways to work around this, below is an example but it really depends if you want to catch the error or adjust the input data. (if this is the issue).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel([FieldName], [FarmAcres], [FutureCrop1], [FutureCrop2], [FutureCrop3], [IrrigationType], [PlantDate]):
    
    if [FieldName]is not None and [FarmAcres] is not None and [PlantDate] is not None:


        if [FutureCrop2] is None and [FutureCrop3] is None:
            result = "Field #" + [FieldName] + "\n" + str([FarmAcres]) + " Acres" + "\n" + [FutureCrop1] + "\n" + [IrrigationType] + "\n" + str([PlantDate])

        elif [FutureCrop3] is None:
            result = "Field #" + [FieldName] + "\n" + str([FarmAcres]) + " Acres" + "\n" + [FutureCrop1] + "/" + [FutureCrop2] + "\n" + [IrrigationType] + "\n" + str([PlantDate])

        else:
            result = "Field #" + [FieldName] + "\n" + str([FarmAcres]) + " Acres" + "\n" + [FutureCrop1] + "/" + [FutureCrop2] + "/" + [FutureCrop3] + "\n" + [IrrigationType] + "\n" + str([PlantDate])


        return result

    else:

        return "Error - Null Value in FarmAcres, FieldName or PlantDate"
        &lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Jan 2021 19:27:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014799#M35773</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-07T19:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014801#M35774</link>
      <description>&lt;P&gt;Thanks so much! We only want it to show whatever values are in there. If a value is null or none, we want it to just exclude that value. I really appreciate you spending time on this. We rarely have to change our labels (hence why we are still using VB) but this helps me understand this process better. I'm the only one for my company working in this program so I really value this input, thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 19:32:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014801#M35774</guid>
      <dc:creator>Lauren-H</dc:creator>
      <dc:date>2021-01-07T19:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014803#M35775</link>
      <description>&lt;P&gt;Did it work?&lt;/P&gt;&lt;P&gt;If so, in the final else block, just return None, or delete the last else entirely.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 19:36:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014803#M35775</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-07T19:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014813#M35777</link>
      <description>&lt;P&gt;Invalid Expression&lt;BR /&gt;&amp;nbsp;File "&amp;lt;string&amp;gt;",line 3&lt;BR /&gt;&amp;nbsp; if esri__0is not None and esri__1 is not None and&lt;BR /&gt;esri__6 is not None:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^&lt;BR /&gt;SyntaxError: invalid syntax&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Don't feel like you have to continue working on this if you cannot, I will continue digging or reach out to support if needed. Thanks for everything so far.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 19:48:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014813#M35777</guid>
      <dc:creator>Lauren-H</dc:creator>
      <dc:date>2021-01-07T19:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014821#M35778</link>
      <description>&lt;P&gt;Sound like giving up talk.&lt;/P&gt;&lt;P&gt;Just a typo on the 3rd Line, also forgot to include irrigationtype.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def FindLabel([FieldName], [FarmAcres], [FutureCrop1], [FutureCrop2], [FutureCrop3], [IrrigationType], [PlantDate]):
    
    if [FieldName] is not None and [FarmAcres] is not None and [PlantDate] is not None and [IrrigationType] is not None:


        if [FutureCrop2] is None and [FutureCrop3] is None:
            result = "Field #" + [FieldName] + "\n" + str([FarmAcres]) + " Acres" + "\n" + [FutureCrop1] + "\n" + [IrrigationType] + "\n" + str([PlantDate])

        elif [FutureCrop3] is None:
            result = "Field #" + [FieldName] + "\n" + str([FarmAcres]) + " Acres" + "\n" + [FutureCrop1] + "/" + [FutureCrop2] + "\n" + [IrrigationType] + "\n" + str([PlantDate])

        else:
            result = "Field #" + [FieldName] + "\n" + str([FarmAcres]) + " Acres" + "\n" + [FutureCrop1] + "/" + [FutureCrop2] + "/" + [FutureCrop3] + "\n" + [IrrigationType] + "\n" + str([PlantDate])


        return result

    else:

        return None&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Jan 2021 20:04:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014821#M35778</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-07T20:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014828#M35780</link>
      <description>&lt;P&gt;Haha! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The error now was&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Error code 2 on line 98&lt;BR /&gt;Expected 'Then'&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 20:16:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014828#M35780</guid>
      <dc:creator>Lauren-H</dc:creator>
      <dc:date>2021-01-07T20:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014847#M35783</link>
      <description>&lt;P&gt;Hmmm, I'm thinking there's something in your data, I tested the expression on a made up sample dataset and it worked.&lt;/P&gt;&lt;P&gt;Are you able to share the data or table? Did you use the exact code in my last reply? Can you screenshot your label properties window?&lt;/P&gt;&lt;P&gt;If not, I'd advice exporting say 1 or 2 features that appear to be attributed correctly, then testing the expression on just those.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 21:03:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1014847#M35783</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-07T21:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Label Expression (VBS)</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1019841#M36351</link>
      <description>&lt;P&gt;Sorry this took some time to reply - I was pulled to another project and wasn't able to work on this .&lt;BR /&gt;&lt;BR /&gt;I retried my original expression today on a different map and it seemed to have worked. I'm not sure why but it seems to be an issue with that original map I was working on. I appreciate your help and input on this!! Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 21:37:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/label-expression-vbs/m-p/1019841#M36351</guid>
      <dc:creator>Lauren-H</dc:creator>
      <dc:date>2021-01-25T21:37:46Z</dc:date>
    </item>
  </channel>
</rss>

