1

I'm working on an application that would reference phone numbers in an online application that would allow our call center to automatically call the number depending on the jurisdiction. When I take the field that has the phone number in it write out the code for it to be reference in HTML a decimal is added.

"<a href=""tel:91!number!"">!number!</a>"

I have gone into the number column and turned off decimal, but get the same results.

Has anyone else had this problem with ArcGIS Pro 2.2.1?

enter image description here

Field Calculator Results

  • 1
    What type of field is number? Is it an integer, a float or a double? Or is it text? If it's a float or a double, then it will still store the decimal part. I suggest either storing number as an integer, or casting it as an integer in your formula. That is int(number). – Fezter Dec 3 '18 at 23:15
  • 1
    It's probably better off as a string, because you do not want to treat a phone number as numeric. – mkennedy Dec 3 '18 at 23:20
  • @mkennedy I tried converting the number as a string, but the field calculator equation will not pass with a string. – AvidDabbler Dec 4 '18 at 15:37
3

Changing the number of decimal places, as you have in the Number Format diaglog, will only change how the data appears in ArcGIS Pro. It won't change the underlying data which is still decimal.

I suggest casting your number to an integer using something like int(number). Or, as mkennedy has suggested, store your phone number as text. Especially if you may have numbers beginning with a zero.

  • revised the code to: "<a href=""tel:91{}"">{}</a>" .format(int(!number!), int(!number!)) worked perfectly. Thanks everyone. – AvidDabbler Dec 4 '18 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.