Formatting labels

1105
1
03-27-2017 08:31 AM
meganbarron
New Contributor II

Not knowledgeable with coding, but I am trying to format labels for this one layer. I want 2 attributes labeled and have currently achieved, but for one of them I want it displayed as currency and rounded. I have found how to do each of these, however I'm a little confused how to implement both at the same time.

I am keeping in mind consistency of what I use (Python vs VBScript vs JScript) and am so far using VBScript for both, but

FormatPercent & Round ([LAYER], 1)

does not work, and neither does removing the ampersand (and second space), nor putting the layer and 'Round' in an inner set of parentheses or anything.

Does anyone know of resources for how to apply multiple formats to the same layer? I found an example in our own data but it was for the text in particular (italics, bold, font size, color), using tags similar to (but NOT identical) HTML, however this of course is different.

0 Kudos
1 Reply
TedKowal
Occasional Contributor III

It is quite difficult to determine what you are trying to do?  Maybe show the table with the required fields you wish to label and a sample formatted output you desire would help.  Your field named [Layer] is misleading is this referring to a layer on your map? or referencing something else altogether?

So at first pass I am going on the assumption " I want it displayed as currency and rounded."

FormatNumber([Cost],2)  <-- Will round to two decimal places

FormatNumber(number [,DecimalPlaces [,IncludeLeadingZero [,UseParenthesis [, GroupDigits]]]] )
or
FormatCurrency(Expression[,NumDigAfterDec[,IncLeadingDig[,UseParForNegNum[,GroupDig]]]])

number : The number to format.
DecimalPlaces : Number of digits to display after the decimal point.
IncludeLeadingZero : Include a leading zero for numbers <1 and > -1
UseParenthesis : Show negative numbers in Parentheis (500) = -500
GroupDigits : Group large numbers with commas (or the regional delimiter)