dynamic text currency format

1455
7
09-06-2019 11:17 AM
MartieClemons
New Contributor II

I created a map series in ArcGIS Pro and have dynamic text for cost values coming from a field which is double but no values have decimals.  I would like the numbers to have commas every three numbers, e.g. for the value 1234567 I would like the dynamic text to show 1,234,567.  Is this possible and if so, what is the code I need to use?

0 Kudos
7 Replies
TomBole
Esri Regular Contributor

Hi Martie, 

You can set the comma separator by formatting the number for your field in the Fields View for the layer/table.  See An overview of fields—Geodatabases | ArcGIS Desktop. The Table Frame will respect any number formatting you set. In the example below I've formatted the field "POP1990" to show the separators.

1. In the Contents pane right-click the layer or table you want to change

2. From the context hover over "Design" and click "Fields" from the pull-right menu to pen the Fields View

As you can see the Table Frame display the commas.  I've also set the values in the table to be right-aligned.

1. In the Contents pane expand the Table Frame item

2. Right-click the field you want to change and click Properties to open the Format Table Frame Fields pane

3. In the Format Table Frame Fields pane click "Text Symbol"

4. Expand "Position" and click third Horizontal alignment option from the left

Hope this helps, 

Tom

0 Kudos
MartieClemons
New Contributor II

Thanks, Tom.  This makes the table view show the correct format but will it transfer to the dynamic text in my map series?  My work-around was to create a new text field, calc the numbers into it and then calc:

"{:,}".format('CostInteger')

Then I changed my dynamic text to point to this new text field.  But if there's a way to use HTML in the dynamic text to format the numeric field as currency, then obviously that would be the best.

0 Kudos
TomBole
Esri Regular Contributor

Yes, Dynamic Text will also honor the number formatting for the field.  

0 Kudos
MartieClemons
New Contributor II

Tom, I applied the formatting of 0 decimals and checked the thousands separators box for the field but nothing happens in the attribute table.

0 Kudos
TomBole
Esri Regular Contributor

Martie,

Once you save the changes in the Fields View the changes should automatically be picked up by the attribute table, table frame (on the layout) or dynamic text.

If things are not working as expected then it is quite possible you have run into a bug.  Currently, I'm not aware of any issue where number formatting is applied (saved) to a layer and this change is not reflected in the attribute table, table frame (on the layout) or with dynamic text. 

Can you contact Esri Support? They are better equipped to handle troubleshooting steps and gather bug data. They can be contacted at https://support.esri.com/en/contact-tech-support.

Thanks, 

Tom

0 Kudos
MartieClemons
New Contributor II

Thanks (embarrassed).  I keep forgetting that I need to save because I never started editing (ArcMap habits)! Anyway, the values look great in the table but when I reference the field in a dynamic text item in my map series, the formatting gets lost.  Here's my dynamic text: $ <dyn type="page" property="attribute" field="MockupTablev3_TOTAL_COST"/>

0 Kudos
TomBole
Esri Regular Contributor

Martie, 

I don't know of any reasons why a dynamic text would ignore number formatting.  In my quick test everything looked fine.  Could be something specific with your data/layer/map/layout. 

You might try using the Value dynamic text element found under Table Attribute and see if that works.

If you can't get this to work I would treat this issue as a bug and take it to technical support. They can be contacted at https://support.esri.com/en/contact-tech-support.

Tom

0 Kudos