Select to view content in your preferred language

Why does this Python label expression fail to add a new line?

176
7
Monday
GerryGabrisch
Frequent Contributor

This Python label properties expression ought to add a new line but it fails to do so.  Any clues are appreciated.

 

[Contour] + ' ft NAVD88' + '\n' + str(float([Contour]) + 0.79) + ' ft MLLW'

 

Capture.JPG

0 Kudos
7 Replies
DanPatterson
MVP Esteemed Contributor

from

Specify text for labels—ArcGIS Pro | Documentation

A label expression can be either a simple single-line expression or a more complex expression spanning multiple lines of code and using the parser's programming logic. Arcade enables complex expressions by default. When using Python, VBScript, or JScript, check the Advanced check box and wrap the code in a function to enable multiline expressions.

So you need to write a "def"


... sort of retired...
0 Kudos
KenBuja
MVP Esteemed Contributor

I think you're confusing multi-line labels with multi-line expressions. This single-line expression works properly in my testing.

Snag_2aba7a.png

GerryGabrisch
Frequent Contributor

Another bug?! This software is maddning.  I am on v3.4.  How about you KenBuja?

0 Kudos
KenBuja
MVP Esteemed Contributor

This was on 3.5.2

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Taking a quick look through ArcGIS Pro 3.4 Issues Addressed and ArcGIS Pro 3.5 Issues Addressed, nothing in Pro 3.4 patches or Pro 3.5 seems to involve a labeling defect that would cause this difference between versions.

0 Kudos
HansRasmussen
Occasional Contributor

You didn't have "Remove extra line breaks" checked maybe?  I tend to use '\r\n'

0 Kudos
GerryGabrisch
Frequent Contributor

I did try '\r\n' to no avail before posting.  Remove extra line breaks is unchecked.

0 Kudos