<?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: Arcade expression for area ranges (max and min) with Null values in labels in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003212#M34440</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/248339"&gt;@DianaWilson1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Have a look at the example below. It consists of 3 functions ("RemoveNulls", "MinOK" and "MaxOK") and at the end a couple of lines of code to create the initial list from your attribute values. It will remove the empty values from the list and return a corrected list that allows you to use the Min and Max (and other) functions:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Function RemoveNulls(lst1) {
    // remove empty values from list
    var lst2 = [];
    for (var i in lst1) {
        if (!IsEmpty(lst1[i])) {
            lst2[Count(lst2)] = lst1[i];
        }
    }
    return lst2;
}

Function MinOK(lst1) {
    // return min from corrected list
    var lst2 = RemoveNulls(lst1);    
    if (Count(lst2)&amp;gt;0) {
        return Min(lst2);
    } else {
        return Null;
    }
}

Function MaxOK(lst1) {
    // return max from corrected list
    var lst2 = RemoveNulls(lst1);    
    if (Count(lst2)&amp;gt;0) {
        return Max(lst2);
    } else {
        return Null;
    }
}

// read your input values
var AREA1 = 3;    // $feature.AREA1
var AREA2 = 7;    // $feature.AREA2
var AREA3 = null; // $feature.AREA3
var AREA4 = 2;    // $feature.AREA4

// create a list
var lst = [AREA1, AREA2, AREA3, AREA4];

// determine min and max values
var minval = MinOK(lst);
var maxval = MaxOK(lst);

// return result
return minval + "-" + maxval;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Nov 2020 22:26:41 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2020-11-19T22:26:41Z</dc:date>
    <item>
      <title>Arcade expression for area ranges (max and min) with Null values in labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003193#M34436</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;I am working in a arcade expression for label the size range for each parcel with multiple buildings with different size. I have 4 fields: "Area1", "Area2", "Area3", and "Area4". There are null values in the within the fields. I wrote those expressions, but they do not work. could you please review it and let me know how will be the right expression.&lt;BR /&gt;If(!IsEmpty($feature.AREA1)) {return($feature.AREA1)}&lt;BR /&gt;else if (!IsEmpty($feature.AREA2)) {return($feature.AREA2)}&lt;BR /&gt;else if (!IsEmpty($feature.AREA3)) {return($feature.AREA3)}&lt;BR /&gt;else if (!IsEmpty($feature.AREA4)) {return($feature.AREA4)}&lt;BR /&gt;The other expression is:&lt;BR /&gt;Min($feature.AREA1,$feature.AREA2,$feature.AREA3,$feature.AREA4)+"-"+Max($feature.AREA1,$feature.AREA2,$feature.AREA3,$feature.AREA4)&lt;BR /&gt;With the second expression, as an example I get expression like 0-1050. but I do not want to get the "0", just because there is a null value in the "Area1"&lt;BR /&gt;Any advice? thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 21:50:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003193#M34436</guid>
      <dc:creator>DianaWilson1</dc:creator>
      <dc:date>2020-11-19T21:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for area ranges (max and min) with Null values in labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003212#M34440</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/248339"&gt;@DianaWilson1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Have a look at the example below. It consists of 3 functions ("RemoveNulls", "MinOK" and "MaxOK") and at the end a couple of lines of code to create the initial list from your attribute values. It will remove the empty values from the list and return a corrected list that allows you to use the Min and Max (and other) functions:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Function RemoveNulls(lst1) {
    // remove empty values from list
    var lst2 = [];
    for (var i in lst1) {
        if (!IsEmpty(lst1[i])) {
            lst2[Count(lst2)] = lst1[i];
        }
    }
    return lst2;
}

Function MinOK(lst1) {
    // return min from corrected list
    var lst2 = RemoveNulls(lst1);    
    if (Count(lst2)&amp;gt;0) {
        return Min(lst2);
    } else {
        return Null;
    }
}

Function MaxOK(lst1) {
    // return max from corrected list
    var lst2 = RemoveNulls(lst1);    
    if (Count(lst2)&amp;gt;0) {
        return Max(lst2);
    } else {
        return Null;
    }
}

// read your input values
var AREA1 = 3;    // $feature.AREA1
var AREA2 = 7;    // $feature.AREA2
var AREA3 = null; // $feature.AREA3
var AREA4 = 2;    // $feature.AREA4

// create a list
var lst = [AREA1, AREA2, AREA3, AREA4];

// determine min and max values
var minval = MinOK(lst);
var maxval = MaxOK(lst);

// return result
return minval + "-" + maxval;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 22:26:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003212#M34440</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-19T22:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for area ranges (max and min) with Null values in labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003437#M34462</link>
      <description>&lt;P&gt;Xander,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you! The query is not giving me the max and min in all the parcels. Look screen shot. Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 14:36:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003437#M34462</guid>
      <dc:creator>DianaWilson1</dc:creator>
      <dc:date>2020-11-20T14:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for area ranges (max and min) with Null values in labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003469#M34467</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/248339"&gt;@DianaWilson1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you share more information about how you implemented the expression? I just did a test with the values you shared in the image and it works as expected:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XanderBakker_0-1605886445523.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/682i9A307A46A677C5D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="XanderBakker_0-1605886445523.png" alt="XanderBakker_0-1605886445523.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 15:34:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003469#M34467</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-20T15:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for area ranges (max and min) with Null values in labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003508#M34469</link>
      <description>&lt;P&gt;I see the mistake that I made, I fixed and it works! Thank you,&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to display the decimal places in this query. I used&amp;nbsp;TEXT($feature.AREA1,'#,###'); but I just got NaN&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 16:32:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003508#M34469</guid>
      <dc:creator>DianaWilson1</dc:creator>
      <dc:date>2020-11-20T16:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for area ranges (max and min) with Null values in labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003531#M34471</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/248339"&gt;@DianaWilson1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume you applied the text formatting to the original value and not to the resulting min and max value after processing the values. It is best to apply it on the lines below:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// determine min and max values
var minval = Text(MinOK(lst), "#,###");
var maxval = Text(MaxOK(lst), "#,###");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will return the result with the thousands separator as shown below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XanderBakker_0-1605892555173.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/695iB177EECA8AC0C98B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="XanderBakker_0-1605892555173.png" alt="XanderBakker_0-1605892555173.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 17:16:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003531#M34471</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-20T17:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression for area ranges (max and min) with Null values in labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003604#M34478</link>
      <description>&lt;P&gt;Thank you Alex! you are the best!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 19:39:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-for-area-ranges-max-and-min-with/m-p/1003604#M34478</guid>
      <dc:creator>DianaWilson1</dc:creator>
      <dc:date>2020-11-20T19:39:28Z</dc:date>
    </item>
  </channel>
</rss>

