Dynamic text returns <NULL> value when using Sum.

219
6
Jump to solution
11-04-2019 09:31 AM
Highlighted
New Contributor III

Hello,

I am trying to use a Dynamic Text box to return the sum value of a numeric field which has been filtered using a custom query via the Insert Table Statistic tool.

My problem:

If the query returns a feature, then the Dynamic Text returns the appropriate sum.

However, if the query does not return a feature, the Dynamic Text returns a <NULL> value.

In the same scenario, the Count tools returns a (0) value.

I understand that there are no values returned to sum, however shouldn't there be an option for a default value such as (0)?  There appears to be one when dealing with a string values, but not when dealing with numeric values via the sum statistic tool.  

Does anyone know how to work around this so I can get a default value of (0) returned if there are no features that match the query?  I know ArcGIS Online has an option as well, seems logical that there would be an option in ArcGIS Pro....

Here is my Dynamic Text code in the Format Text properties box.  Note, I tried using the emptyStr="0" option, but it did not work.  Is there an equivalent as an emptyIntegar=(0)?

<dyn type="table" property="sum" mapFrame="Map Frame" mapMemberUri="CIMPATH=59c80d386578416b83006b9fd9763d66.xml" sql="PROVINCE = 'FEZZAN'" field="INJURED" decimalPlaces="0" separator="false" emptyStr="0"/>

<FNT style="Regular" size="20"> INJURED </FNT>

Thanks,

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Esri Contributor

Hi,

You found a bug! The emptyStr tag should work in this case. We'll look at fixing this in a future release of ArcGIS Pro. Unfortunately the only workaround I can think of in the meantime is to update your data to change your nulls to 0, which I know isn't always an option. 

Cheers,

Aubri K

View solution in original post

6 Replies
Highlighted
Frequent Contributor II

put a space on either side of your code

Reply
0 Kudos
Highlighted
New Contributor III

Didn't seem to help, put it in text mode or something.

Reply
0 Kudos
Highlighted
Esri Contributor

Hi,

You found a bug! The emptyStr tag should work in this case. We'll look at fixing this in a future release of ArcGIS Pro. Unfortunately the only workaround I can think of in the meantime is to update your data to change your nulls to 0, which I know isn't always an option. 

Cheers,

Aubri K

View solution in original post

Highlighted
New Contributor III

So does that mean I get a sticker or a cookie or something like that?

The strange thing is that after receiving the error, I did the logical thing and set (0) as my default value on the feature class in question.  Still no luck.

So I decided I would do a work around and make a handful of maps with static values for the different options in question and then have the script kick out the needed one based upon a count in Python.  In doing so, I exported the layout as a template and brought it back it.

The irony of it was that once I reconnected the layers to the feature classes in the database, the new layout work as intended with all the dynamic text boxes returning what they should.

However, even after saving the project, closing out and reopening, the original layout still returns <NULL> values while the newer one built off of its template works like a charm....

Reply
0 Kudos
Highlighted
Esri Contributor

Intriguing. I'm glad you were able to take advantage of layout files, but that's odd that it doesn't work on the first one. Weird. I'll keep an eye out for that and see what we can do. 

Thanks!

Reply
0 Kudos
Highlighted
New Contributor III

Don't know if this matters, but just realized that the original layout was using data with a URL address instead of my local database.  Once I set the data source to my local database and refreshed the layout map everything appears to be working normally.  Granted when I had previously created a new layout via the layout template, that new one worked regardless of the source.

Hopefully that makes sense.

Reply
0 Kudos