# Perspective Line Breaks in text label/markdown

**URL:** <https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 7, 2021, 6:23pm UTC](https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715 "2021-10-07T18:23:11Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 15, 2024, 1:32pm UTC](https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715/21 "2024-02-15T13:32:11Z")

</div>

Try this:

```auto
if tag_check_neagtive:	
    negative_message = 'This chart is unavailable for string type data. Please unselect the tags listed below from the Tag Tree Browser.'

    negative_message += '<br/>'.join([r'\[{}\]{}'.format(tag.source,tag.toStringPartial()) for tag in tag_check_neagtive])

    system.perspective.openPopup("Warning", "test", 
                                 {"message": negative_message}, "Error", 
                                 modal=True, showCloseIcon=True, draggable=False, resizable=False)

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 15, 2024, 1:48pm UTC](https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715/22 "2024-02-15T13:48:09Z")

</div>

Or you can replace `[` with HTML entity `&#91;` and `]` with `&#93;`.

By the way, I think you have spelt "negative" incorrectly in "tag\_check\_neagtive:". You might want to fix that.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 15, 2024, 1:51pm UTC](https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715/23 "2024-02-15T13:51:10Z")

</div>

> [@Transistor](#):
>
> Or you can replace `[` with HTML entity `&#91;` and `]` with `&#93;`.

This will also work, I've just always found that very cryptic.

I noticed the typo as well.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [February 15, 2024, 2:24pm UTC](https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715/24 "2024-02-15T14:24:02Z")

</div>

getting some error

`negative_message += '<br/>'.join([r'\[{}\]{}'.format(tag.source,tag.toStringPartial()) for tag in tag_check_neagtive])`

code is not passing this line

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 15, 2024, 2:25pm UTC](https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715/25 "2024-02-15T14:25:23Z")

</div>

Hard to help if I don't know what the error is.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [February 15, 2024, 2:33pm UTC](https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715/26 "2024-02-15T14:33:17Z")

</div>

```auto
com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
  File "<function:onMessageReceived>", line 87, in onMessageReceived
AttributeError: 'unicode' object has no attribute 'source'

	caused by org.python.core.PyException
Traceback (most recent call last):
  File "<function:onMessageReceived>", line 87, in onMessageReceived
AttributeError: 'unicode' object has no attribute 'source'

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 15, 2024, 2:39pm UTC](https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715/27 "2024-02-15T14:39:38Z")

</div>

Okay, so the list, is really a list of strings, not `TagPath` objects.

```auto
if tag_check_neagtive:	
    negative_message = 'This chart is unavailable for string type data. Please unselect the tags listed below from the Tag Tree Browser.'

    negative_message += '<br/>'.join([r'\[{}\]{}'.format(tag[1:tag.find(']')],tag[tag.find(']') + 1:]) for tag in tag_check_neagtive])

    system.perspective.openPopup("Warning", "test", 
                                 {"message": negative_message}, "Error", 
                                 modal=True, showCloseIcon=True, draggable=False, resizable=False)
```

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [February 15, 2024, 2:43pm UTC](https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715/28 "2024-02-15T14:43:39Z")

</div>

> [@lrose](#):
>
> `negative_message += '<br/>'.join([r'\[{}\]{}'.format(tag[1:tag.find(']')],tag[tag.find(']') + 1:] for tag in tag_check_neagtive])`

Its working there is syntax error i have corrected it

`negative_message += '<br/>'.join([r'\[{}\]{}'.format(tag[1:tag.find(']')], tag[tag.find(']') + 1:]) for tag in tag_matched])`

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [February 19, 2024, 1:09am UTC](https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715/29 "2024-02-19T01:09:18Z")

</div>

> [@prasath.t](#):
>
> negative\_message += '  
> '.join([r'[{}]{}'.format(tag[1:tag.find(']')], tag[tag.find(']') + 1:]) for tag in tag\_matched])

As an alternative, you can also use `re.split` to split by multiple delimiters, instead of using find:

```auto
import re
a = '[default]tag/path'
re.split('\[|\]', a)[1:] # split by "[" or "]", discarding the first find

>> ['default', 'tag/path']

```

[Previous page](https://forum.inductiveautomation.com/t/perspective-line-breaks-in-text-label-markdown/51715.md?page=1)
