Calculate Values using Dynamic Text

826
6
02-17-2020 05:41 PM
FPCWAGIS_Admin
New Contributor III

Hi brains trust. I'm hoping someone can guide me here. Is it possible to use Dynamic Text in ArcGIS Pro to return the SUM of values in an attribute table (got this bit down pat) and then calculate/format a display value. 

For example, I run the SUM function on the Shape_Area field and it returns metres squared but I want to display it as Hectares. In labeling scripts this would be done like this using VB script:  formatnumber(Shape_Area\10000, 1). 

Another calculation I'd like to do is take the SUM and multiple by 0.5 or 0.3 to get a percentage of the SUM. 

An extension to this is, can separate values in dynamic text be added together to get a total (i.e. SUM A, plus SUM B = Total)?

0 Kudos
6 Replies
RickeyFight
MVP Regular Contributor
0 Kudos
FPCWAGIS_Admin
New Contributor III

No I hadn't, but it's not labels that I'm trying to create. I'm trying to create Dynamic Text in the Layout (i.e. A statistics summary in the legend area with Sums of different area values with calculations applied)

0 Kudos
RickeyFight
MVP Regular Contributor

FPCWA GIS Admin

I am assuming you are using arcgis pro.

Are you summing multiple polygons at once? 

have you looked here

Modify dynamic text—Layouts | Documentation 

0 Kudos
FPCWAGIS_Admin
New Contributor III

Hi Rickey. Yep - using ArcGIS Pro 2.5. It is summing multiple polygons based on the Shape_Area field (m2). I was hoping to be able to calculate some features to be a percentage of the value in the Shape_Area field based on categories in a different field (i.e. Category = 30% would result in Shape_Area x 0.3 for that row only). I don't think it is quite there yet from what I can find. Might have to try using Model Builder to generate a statistics table or something in the layout. 

0 Kudos
BrettGovernanti1
New Contributor III

Hi you might have figured something out but if not, I was wanting to do something similar, but instead to modify the dynamic text of a summed ShapeLength field in feet to show that sum in miles. I'm using Pro 2.8.3 and added a dynamic text for Sum. Once created get into the dynamic text Format Text window and modify the plain text after after the field="SHAPE_Length" portion of the dynamic text code and enter your conversion factor. Next click the Tag View for it to take. Here's mine:

Day Segment Sum: <dyn type="table" property="sum" mapFrame="Monday Frame Map Frame" mapMemberUri="CIMPATH=friday_small_frame_2/residential_routes_jw_6_fri_2.xml" field="SHAPE_Length * 0.00018939" decimalPlaces="2" separator="true"/> miles

Walla!

LindsayRaabe_FPCWA
Occasional Contributor III

Hi @BrettGovernanti1 I've just seen your reply (posted the thread using the wrong account so didn't get notified. I just tried out your suggestion and it works well. Can't remember what the original use case-problem was but this definitely works well. 

Funnily enough though, when setting up the little test I did, the SUM dynamic text element was very unpredictable. When setting it to Visible rows, it would show the total of all rows still, but as soon as I added in the /1000 to convert to Kilometres, it would show the correct visible only figure. Tried a number of ways to get it to show what it should depending on the settings, but only the modified version of the text returned an accurate result. 

Lindsay Raabe
Forest Products Commission WA
0 Kudos