Add Space Between Combined Fields in Field Calculator

12281
34
Jump to solution
05-07-2018 07:30 AM
JRAdams
New Contributor III

In the ArcGIS Online field calculator I am trying to combine a few other fields into one (address field) and cannot figure out how to put a space between the fields. I am sure it is something simple, but I am unable to find the answer elsewhere. Please help! I've tried everything I can think of. 

Thank you!!! AGOL Admin fieldcalculator #arcgisonline

0 Kudos
34 Replies
DougBrowning
MVP Esteemed Contributor

How can I do leading spaces?  It keeps striping them out when using Arcade in a Pop up.

This

return "\n" + "      Line Number Issue! Found: " + txt

Does this - notice no spaces - I want to indent it.

Ideas?

Thanks

0 Kudos
DanPatterson_Retired
MVP Emeritus

\a  is the bell, so try it with your speakers off, \n and \t are considered whitespace.  So it python-esque principles are followed, you can always find something that doesn't print, but isn't considered whitespace

a = "\n\t\a     Line Number Issue! Found: "

print(a.strip())
     Line Number Issue! Found:
0 Kudos
DougBrowning
MVP Esteemed Contributor

I tried \n\t\t\t\t\t\t\a and got this

a--!!! Line Number Issue! Found: 1-3 

No space or bell.

0 Kudos
DanPatterson_Retired
MVP Emeritus

throw an r in front of the string r" it is now raw encoded"

if it is python that it is using, it isn't python 3

0 Kudos
DougBrowning
MVP Esteemed Contributor

Arcade says Invalid string when I try that.  This is an Arcade popup not python.

0 Kudos
JimmyKroon
Occasional Contributor II

Any html in the string will be interpreted, when the popup is displayed in a browser. So you can use html non-breaking space characters -      - which will be displayed as spaces in the popup. Or a little fancier, you can also use in-line css styling to left-pad the line.

Outputing this as a string should work.

<p style="padding-left:10px;">This is your error!</p>

Jimmy

0 Kudos
JimmyKroon
Occasional Contributor II

Of course, I above it was interpreted as a space!

That'd be   & n b s p ;         - remove the spaces in the middle.

0 Kudos
DougBrowning
MVP Esteemed Contributor

I do understand this post.

0 Kudos
KellyGerrow
Esri Frequent Contributor

Hey Joe,

If using the calculate option in ArcGIS Online, you need to apply a specific filter in order to only calculate specific fields. Can you log an idea about calculating fields based on table selection on ArcGIS Ideas‌. I think this would be helpful to others also:

Work with fields—ArcGIS Online Help | ArcGIS 

-Kelly

0 Kudos
JoeBorgione
MVP Emeritus

Vote early and vote often!  https://community.esri.com/ideas/14979 

Kelly Gerrow

That should just about do it....