Calculate field inserting extra characters

461
3
Jump to solution
08-07-2020 07:59 AM
JoeLivoti
New Contributor III

I am trying to add a hyperlink to a layer referencing another field in the layer. I'm using python3 expression type in the calculate field window. Below is the code:

'https://s3.console.aws.amazon.com/s3/buckets/hamptondes/Manhole/!FACILITYID!'

However, It is populating with:

https://s3.console.aws.amazon.com/s3/buckets/hamptondes/Manhole/u"00133" 

For some reason it is adding the u and the " " around my facility ID

I need it to simply be:

https://s3.console.aws.amazon.com/s3/buckets/hamptondes/Manhole/00133

Any help is greatly appreciated!

0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

 Try:

r"url=https://s3.console.aws.amazon.com/s3/buckets/hamptondes/Manhole/{}".format(!FACILITYID!)

View solution in original post

3 Replies
DanPatterson
MVP Esteemed Contributor

If you need a string returned, then you need to concatenate the inputs as strings

r = r"https://s3.console.aws.amazon.com/s3/buckets/hamptondes/Manhole/"

f = "{}{}".format(r, "00133")

f
'https://s3.console.aws.amazon.com/s3/buckets/hamptondes/Manhole/00133'

if it is something else, the link is no good, copy the code here if possible.


... sort of retired...
JoshuaBixby
MVP Esteemed Contributor

 Try:

r"url=https://s3.console.aws.amazon.com/s3/buckets/hamptondes/Manhole/{}".format(!FACILITYID!)
JoeLivoti
New Contributor III

Thank you both for your help! I used this in the field = 

'https://s3.console.aws.amazon.com/s3/buckets/hamptondes/Manhole/{}'.format(!FACILITYID!) 

0 Kudos