Advanced Formatting use and having the numbers formatted with commas

1304
6
Jump to solution
10-22-2021 06:56 AM
LorindaGilbert
Occasional Contributor II

Hi,

I'm creating a dashboard without a map, only statistics.  I know that if I was using a map that I could change it in the web map.  But this one is only numbers and pie charts.  I'm using advanced formatting to generate some of the data that is used in indicators.  How do I get the commas to show up in numbers such as 30,705 rather than 30705?

Thanks,

Lorinda

1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

If popdiff is the label, not the data, you can use this

var popdiff = Text(tot20 - tot10, '#,###')

Have a great day!
Johannes

View solution in original post

6 Replies
ABishop
MVP Regular Contributor

@LorindaGilbert 

Hello... I think you may have to format the data this way before adding it to your dashboard.  Either in the data source itself (ie. database, service, etc.) or in a web map.  I know there is a way to show comma separators in a web map by formatting the fields.

Amanda Bishop, GISP
0 Kudos
LorindaGilbert
Occasional Contributor II

Actually, yes, the data is formatted the way I want for the simple content.  However, I'm using the advanced formatting in the online version of dashboards.  I'm looking for how to have the calculated fields have the commas included.  They are calculating properly, just not formatted properly.

Thanks,

Lorinda

ABishop
MVP Regular Contributor

@LorindaGilbert 

I think @SteveOwens answered your questions below?

Amanda Bishop, GISP
0 Kudos
SteveOwens
New Contributor III

Go to Configure and click on Indicator.

Click on Edit off to the right of Value Formatting and turn on Digit grouping.

SteveOwens_2-1634912059627.png

SteveOwens_1-1634911922682.png

 

LorindaGilbert
Occasional Contributor II

Using Advanced Formatting, the Value Formatting is disabled.  Hence, asking for if there is a CSS, HTML, javascript, what have you type of formatting that will be in this scripting:

var tot20 = $datapoint["TOTAL"]
var tot10 = $datapoint["TOTAL_1"]
var popdiff = tot20 - tot10

return {
//textColor:'',
//backgroundColor:'',
//topText: '',
//topTextColor: '',
//topTextOutlineColor: '',
//topTextMaxSize: 'medium',
middleText: (popdiff),
middleTextColor: '#38a800',
middleTextOutlineColor: '',
middleTextMaxSize: 'large',
//bottomText: '',
//bottomTextColor: '',
//bottomTextOutlineColor: '',
//bottomTextMaxSize: 'medium',
iconName:'People',
//iconAlign:'left',
iconColor:'#38a800',
//iconOutlineColor:'',
//noValue:false,
//attributes: {
// attribute1: '',
// attribute2: ''
// }
}

 

0 Kudos
JohannesLindner
MVP Frequent Contributor

If popdiff is the label, not the data, you can use this

var popdiff = Text(tot20 - tot10, '#,###')

Have a great day!
Johannes