<?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: Handling NULL Dates in Labels in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97577#M3789</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; So, Server 10.1 doesn't like vbscript "if" statements in label expressions?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;I have just tried it by copy/pasting your vbscript code and it worked fine for me on the server, the layer draws fine with all features labeled with "NO".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have also tried with isnull() as a condition to an if..else statement that worked fine as well.... here is the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Function FindLabel ([DateST]) &amp;nbsp; FindLabel = "y" &amp;nbsp; If (isnull([DateST])) Then &amp;nbsp;&amp;nbsp;&amp;nbsp; FindLabel = "n" &amp;nbsp; End If End Function&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please open an incident with Esri Tech Support.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the mean time, can you try creating two different "label classes" where each label-class will have separate SQL queries - one for all features with NULL value, another for all features with non-null value -- no if..else... business in vbscript?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tanu&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Nov 2012 00:07:23 GMT</pubDate>
    <dc:creator>TanuHoque</dc:creator>
    <dc:date>2012-11-02T00:07:23Z</dc:date>
    <item>
      <title>Handling NULL Dates in Labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97573#M3785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've got an MXD I'd like to publish in 10.1, that worked fine at 10.0.&amp;nbsp; The problem is in the dynamic labels on some of the feature classes.&amp;nbsp; I want to use an advanced label with some vbscript formatting.&amp;nbsp; Some of the records have null values in a date field.&amp;nbsp; I'd like to skip lines in the label when they encounter a null value.&amp;nbsp; It works in ArcMap 10.1 and worked in Server 10.0, but Server 10.1 pukes and refuses to even draw the layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) if [AnnexDate] &amp;lt;&amp;gt; "" then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) if not isnull( [AnnexDate]) then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) if len( [AnnexDate])&amp;gt;0 then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4) if [AnnexDate] &amp;gt;=&amp;nbsp; #01-01-1800 00:00:00# then&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe I'm just lucky with my data, but (miraculously) ArcMap likes all of them and (surprise!) Server doesn't.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've run out of ways to sort out NULL dates.&amp;nbsp; Any suggestions?&amp;nbsp; Other than the obvious: "use Python instead".&amp;nbsp; I haven't had time to upgrade my skills to Python.&amp;nbsp; I am welcome to ideas on what to try in Python, though.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 15:31:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97573#M3785</guid>
      <dc:creator>JamesCueno</dc:creator>
      <dc:date>2012-11-01T15:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Handling NULL Dates in Labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97574#M3786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jim,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've just tried it and I didn't see the issue that you have encountered. Map service simply doesn't label those features with &amp;lt;null&amp;gt; value in date field. The vbscript expression I used for labeling is just the field name (please see all attached screen shots).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have also tried with both FileGDB and SDE (running on SQL Server) and it is the same result - feature draws fine, labeling engine simply don't label features with &amp;lt;null&amp;gt; value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here are my recommendations:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. please contact Tech Support to have them take a look at this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. In the meantime, try this: in ArcMap, open the layer properties &amp;gt;&amp;gt; switch to "Label" tab &amp;gt;&amp;gt; choose "Define classes for features and label each class differently" from the "Method" dropdown box &amp;gt;&amp;gt; click on "SQL Query..." button &amp;gt;&amp;gt; set a query to exclude features with &amp;lt;null&amp;gt; value from being labelled &amp;gt;&amp;gt; click OK&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tanu&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 16:47:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97574#M3786</guid>
      <dc:creator>TanuHoque</dc:creator>
      <dc:date>2012-11-01T16:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: Handling NULL Dates in Labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97575#M3787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Okay, except the label isn't just the field value.&amp;nbsp; Does your label expression use an "if" to evaluate that the field value is not NULL before doing anything else?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try this for your label expression:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Function FindLabel (&amp;nbsp; [AnnexDate]&amp;nbsp; )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lbl=""&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if [AnnexDate] &amp;lt;&amp;gt; "" then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; lbl= lbl&amp;amp;"Annex. Date: "&amp;amp;[AnnexDate] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;end if&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FindLabel = lbl&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Function&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 16:58:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97575#M3787</guid>
      <dc:creator>JamesCueno</dc:creator>
      <dc:date>2012-11-01T16:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Handling NULL Dates in Labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97576#M3788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, this just got more interesting.&amp;nbsp; After ruminating on the problem over lunch, I tried simplifying the expression to: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Function FindLabel (&amp;nbsp; [AnnexDate]&amp;nbsp; )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lbl="YES"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if 1&amp;lt;&amp;gt;2 then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; lbl = "NO"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;end if&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FindLabel = lbl&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Function&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And that doesn't work either.&amp;nbsp; So, Server 10.1 doesn't like vbscript "if" statements in label expressions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Somebody, please, prove me wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It lets me do it in ArcMap and doesn't bothering to let me know when I analyze the project before publishing it, that it might not work.&amp;nbsp; All of things analyze complains about...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 18:14:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97576#M3788</guid>
      <dc:creator>JamesCueno</dc:creator>
      <dc:date>2012-11-01T18:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Handling NULL Dates in Labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97577#M3789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; So, Server 10.1 doesn't like vbscript "if" statements in label expressions?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;I have just tried it by copy/pasting your vbscript code and it worked fine for me on the server, the layer draws fine with all features labeled with "NO".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have also tried with isnull() as a condition to an if..else statement that worked fine as well.... here is the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Function FindLabel ([DateST]) &amp;nbsp; FindLabel = "y" &amp;nbsp; If (isnull([DateST])) Then &amp;nbsp;&amp;nbsp;&amp;nbsp; FindLabel = "n" &amp;nbsp; End If End Function&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please open an incident with Esri Tech Support.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the mean time, can you try creating two different "label classes" where each label-class will have separate SQL queries - one for all features with NULL value, another for all features with non-null value -- no if..else... business in vbscript?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tanu&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2012 00:07:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97577#M3789</guid>
      <dc:creator>TanuHoque</dc:creator>
      <dc:date>2012-11-02T00:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Handling NULL Dates in Labels</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97578#M3790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't know what's magically changed... but it works now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At first I thought it was white-space formatting, because I went in and cleaned-up the code.&amp;nbsp; Made it look pretty (and dropped out the calculation on the area field) and everything worked.&amp;nbsp; So, I tried breaking the code by ruining the formatting.&amp;nbsp; Still works.&amp;nbsp; I pasted in the "if 1&amp;lt;&amp;gt;32" code from yesterday and now that works, too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Whatever.&amp;nbsp; It works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the eyeballs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2012 15:31:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/handling-null-dates-in-labels/m-p/97578#M3790</guid>
      <dc:creator>JamesCueno</dc:creator>
      <dc:date>2012-11-02T15:31:34Z</dc:date>
    </item>
  </channel>
</rss>

