# Perspective Comments Panel

**URL:** <https://forum.inductiveautomation.com/t/perspective-comments-panel/32242>\
**Category:** Ignition Exchange\
**Tags:** perspective\
**Created:** [February 13, 2020, 7:58pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242 "2020-02-13T19:58:57Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirsten.chambers](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kirsten.chambers](https://forum.inductiveautomation.com/u/kirsten.chambers)\
**Post date:** [February 13, 2020, 7:58pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/1 "2020-02-13T19:58:57Z")

</div>

Hi all,

My implementation of a Comments Panel component in Perspective is now live on the exchange!

> **[Ignition Exchange](https://inductiveautomation.com/exchange/1989/overview)**
>
> Discover, share, and download community made Ignition resources in collaboration with your organization or the Ignition community.

I wanted to create a thread so that people can ~~yell at me for my silly implementation~~ provide feedback or information others might find helpful (since I didn’t have an opportunity to test it out with different databases or versions of Ignition on this initial version).

I hope you find it useful. Happy developing!

---

<div class="post-metadata">

**Author:** ![omairapril](https://avatars.discourse-cdn.com/v4/letter/o/439d5e/32.png) [@omairapril](https://forum.inductiveautomation.com/u/omairapril)\
**Post date:** [September 4, 2020, 10:17pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/2 "2020-09-04T22:17:20Z")

</div>

Hi Daniel,

I get an error that global library “Java” not found. Have you encountered this error before?

Do you know how it can be fixed?

Thanks,

---

<div class="post-metadata">

**Author:** ![kirsten.chambers](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kirsten.chambers](https://forum.inductiveautomation.com/u/kirsten.chambers)\
**Post date:** [September 15, 2020, 7:44pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/3 "2020-09-15T19:44:09Z")

</div>

Sorry for missing this for so long, guess I need to get back in the habit of checking the forums! 😬

I can’t say I’ve seen this error, no. Can you give me more details on what’s going wrong, and where?

- What version of Ignition are you using?
- Which component(s) are giving the error? Which script(s)?

I need to be able to reproduce the error, ideally.

---

<div class="post-metadata">

**Author:** ![omairapril](https://avatars.discourse-cdn.com/v4/letter/o/439d5e/32.png) [@omairapril](https://forum.inductiveautomation.com/u/omairapril)\
**Post date:** [September 18, 2020, 1:19pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/4 "2020-09-18T13:19:06Z")

</div>

Hi Daniel,

I tried this on v8.0.5 and v8.0.13.

This is the error I get :

Error running action ‘component.onActionPerformed’ on Components/Comments Panel@D$0:1/root/New Note/FlexContainer/Button: Traceback (most recent call last): File " ", line 24, in runAction NameError: global name ‘java’ is not defined

\*\*\*\*\*\*\*\*\*\* Full Error \*\*\*\*\*\*\*\*\*\*\*\*

com.inductiveautomation.ignition.common.script.JythonExecException  
Traceback (most recent call last):  
File “function:runAction”, line 24, in runAction  
NameError: global name ‘java’ is not defined

```
at org.python.core.Py.NameError(Py.java:290)
at org.python.core.PyFrame.getglobal(PyFrame.java:265)
at org.python.pycode._pyx333.runAction$1(<function:runAction>:41)
at org.python.pycode._pyx333.call_function(<function:runAction>)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyFunction.function ___call__ (PyFunction.java:471)
at org.python.core.PyFunction. __call__ (PyFunction.java:466)
at org.python.core.PyFunction. __call__ (PyFunction.java:456)
at org.python.core.PyFunction. __call__ (PyFunction.java:451)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:788)
at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:917)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:625)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:91)
at com.inductiveautomation.perspective.gateway.action.ScriptAction.runAction(ScriptAction.java:71)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.lambda$call$0(ActionCollection.java:263)
at com.inductiveautomation.perspective.gateway.api.LoggingContext.mdc(LoggingContext.java:54)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:252)
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:221)
at com.inductiveautomation.perspective.gateway.threading.BlockingTaskQueue$TaskWrapper.run(BlockingTaskQueue.java:154)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

```

Caused by: org.python.core.PyException  
Traceback (most recent call last):  
File “function:runAction”, line 24, in runAction  
NameError: global name ‘java’ is not defined

```
... 25 more

```

Ignition v8.0.5 (b2019101516)  
Java: Azul Systems, Inc. 11.0.4

---

<div class="post-metadata">

**Author:** ![kirsten.chambers](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kirsten.chambers](https://forum.inductiveautomation.com/u/kirsten.chambers)\
**Post date:** [September 18, 2020, 4:41pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/5 "2020-09-18T16:41:06Z")

</div>

Did you read and follow the setup instructions? I think this is a database error because you might not have the necessary tables and/or named query in your project–this is not an out-of-the-box usable component. To save you some searching, here’s the instructions copy-pasted from the Exchange:

- After importing all of the resources, open the Comments Panel view and look under it’s custom properties for one called projectName. Set the value of projectName to the name of your project (look at your designer’s titlebar if you don’t remember). This is used within several system.db.runNamedQuery() calls since Perspective operates within the gateway scope.

- Look under your project’s Named Queries for a Comments Panel folder. Run the CreateCommentsTable query somewhere to create the table that your Comments Panels will use to store and retrieve comments (if your database version is unlisted, just use the two given queries as guidelines to write your own–disclaimer, the MySQL one is untested, but it should work).

- Voila! Setup is complete. You can test out your comments panel in the designer and ensure the queries for saving, editing, and deleting comments work. I have not performed any testing on database besides SQL Server, so you may run into some issues–nevertheless, it should be faster to debug than to create your own implementation from scratch (ideally).

- After ensuring the database queries work, use Embedded View components to put comments panels wherever you need them (keeping the width around 375px or so for best out-of-the-box results). Be sure you give each comment panel a unique “id” parameter or they will display the same comments.

---

<div class="post-metadata">

**Author:** ![omairapril](https://avatars.discourse-cdn.com/v4/letter/o/439d5e/32.png) [@omairapril](https://forum.inductiveautomation.com/u/omairapril)\
**Post date:** [September 18, 2020, 5:06pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/6 "2020-09-18T17:06:04Z")

</div>

> [@kirsten.chambers](#):
>
> - Look under your project’s Named Queries for a Comments Panel folder. Run the CreateCommentsTable query somewhere to create the table that your Comments Panels will use to store and retrieve comments (if your database version is unlisted, just use the two given queries as guidelines to write your own–disclaimer, the MySQL one is untested, but it should work).

Hi @kirsten.chambers

I did follow the setup instructions.

I have entered projectName as mentioned in the instructions and the database table has also been created as mentioned in the instructions.

After going through the setup instructions I placed all the components into a view as follows 🙂

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/7/e71b3d782cc3cd865d9302b1f5c746a54f913dcd.png)

---

<div class="post-metadata">

**Author:** ![omairapril](https://avatars.discourse-cdn.com/v4/letter/o/439d5e/32.png) [@omairapril](https://forum.inductiveautomation.com/u/omairapril)\
**Post date:** [September 18, 2020, 5:09pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/7 "2020-09-18T17:09:42Z")

</div>

@kirsten.chambers I get the error when I click on Save after having typed something into the notes.

---

<div class="post-metadata">

**Author:** ![tyler.robertson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tyler.robertson/32/18299_2.png) [@tyler.robertson](https://forum.inductiveautomation.com/u/tyler.robertson)\
**Post date:** [January 11, 2022, 5:33pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/8 "2022-01-11T17:33:23Z")

</div>

hi folks - I tried out the comments panel but didn’t end up using it in my initial project. Didn’t remember having issues there. I’m using it for something else now, and @omairapril the issue you might be having is that you have a non-numeric number as part of the ID.

I’m having some height scaling issues now kirsten that I didn’t remember having previously when I used this. component width is 375px - maybe an 8.1 thing? Doubtful, probably a me thing.

---

<div class="post-metadata">

**Author:** ![IgnitionNewbie](https://avatars.discourse-cdn.com/v4/letter/i/94ad74/32.png) [@IgnitionNewbie](https://forum.inductiveautomation.com/u/IgnitionNewbie)\
**Post date:** [May 18, 2022, 9:38pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/9 "2022-05-18T21:38:06Z")

</div>

I have the exact same issue as omairapril

It should be noted i am using the untested MySQL version

 ![attach](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/8/78333186edebe14e012636da4d41c96576ed31ae.jpeg)

i was digging around in the button and noticed this is a little different? but messing around with it didn’t fix anything

in the onactionperformed the other strings have the str() , like the str(note) and the str(userName) before them but the attach one doesn’t , does this matter?

im kind of just shooting in the dark I dont really understand what is doing what here

---

<div class="post-metadata">

**Author:** ![kirsten.chambers](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kirsten.chambers](https://forum.inductiveautomation.com/u/kirsten.chambers)\
**Post date:** [May 18, 2022, 10:14pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/10 "2022-05-18T22:14:01Z")

</div>

It’s a good guess, since the system.db functions are very particular about the parameters, but you’ll notice on line 15 I am calling `str()` on `attach` so that shouldn’t be the issue.

The think the problem lies in the table. In the MySQL version for creating the table, I seem to have accidentally misnamed one of the columns, which is causing inserting to fail.

Here’s the updated MySQL version of the Comments Panel/CreateCommentsTable query. I’ll push it to the exchange in a bit as well:

```auto
CREATE TABLE PerspectiveComments (
	id INT NOT NULL AUTO_INCREMENT,
	attachmentType VARCHAR(5), -- here's where the error was; it was named 'attachment' instead of 'attachmentType'
	note VARCHAR(500),
	panelId INT NOT NULL,
	sticky BIT,
	tStamp DATETIME,
	userName VARCHAR(50),
	PRIMARY KEY (id) );

```

You can just edit the PerspectiveComments table and rename that column, then hopefully the issue should be resolved.

---

<div class="post-metadata">

**Author:** ![IgnitionNewbie](https://avatars.discourse-cdn.com/v4/letter/i/94ad74/32.png) [@IgnitionNewbie](https://forum.inductiveautomation.com/u/IgnitionNewbie)\
**Post date:** [May 19, 2022, 1:37pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/11 "2022-05-19T13:37:01Z")

</div>

I changed that to match yours since it will probably help , but its still giving that error

is the INSERT INTO in the InsertComment named query supposed to be attachment or attachmentType? also is the name of the parameter in that named query supposed to be attachment or attachmentType?

---

<div class="post-metadata">

**Author:** ![kirsten.chambers](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kirsten.chambers](https://forum.inductiveautomation.com/u/kirsten.chambers)\
**Post date:** [May 19, 2022, 6:15pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/12 "2022-05-19T18:15:10Z")

</div>

Apologies for not making it clear.

Run this instead, @IgnitionNewbie:

```auto
ALTER TABLE PerspectiveComments RENAME COLUMN attachment TO attachmentType;

```

This will rename the old column named `attachment` into `attachmentType`. Changing this query, which is run only once during the setup of the comments panel, won’t do anything on its own.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 19, 2022, 6:25pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/13 "2022-05-19T18:25:51Z")

</div>

Also, it appears that you have a parameter “attachment” defined, but you are attempting to use “:attatch” in the query.

---

<div class="post-metadata">

**Author:** ![kirsten.chambers](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kirsten.chambers](https://forum.inductiveautomation.com/u/kirsten.chambers)\
**Post date:** [May 19, 2022, 6:30pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/14 "2022-05-19T18:30:38Z")

</div>

That’s not how the query originally was–good catch. @IgnitionNewbie be sure to change the InsertComment query that back to how it originally was, including the parameters. Here it is:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/7/57a3b5a460b5e183686367e156c24a21b3ea2fdb.png)

```auto
INSERT INTO PerspectiveComments(note, panelId, sticky, tStamp, userName, attachmentType)
OUTPUT INSERTED.id
VALUES (:note, :panelId, :sticky, :tStamp, :userName, :attachmentType);

```

---

<div class="post-metadata">

**Author:** ![IgnitionNewbie](https://avatars.discourse-cdn.com/v4/letter/i/94ad74/32.png) [@IgnitionNewbie](https://forum.inductiveautomation.com/u/IgnitionNewbie)\
**Post date:** [May 23, 2022, 7:52pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/15 "2022-05-23T19:52:09Z")

</div>

alright i finally was free to try that, still no dice , will keep looking

i see in the get comments my attachmentType is attachment as well , but that didnt fix it either

---

<div class="post-metadata">

**Author:** ![kirsten.chambers](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kirsten.chambers](https://forum.inductiveautomation.com/u/kirsten.chambers)\
**Post date:** [May 23, 2022, 8:27pm UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/16 "2022-05-23T20:27:56Z")

</div>

I think I finally found the problem–it’s in the InsertComment query. There’s an MS SQL-specific statement that I used that doesn’t work in MySQL.

I’m not 100% sure this replacement will work, but it’s worth a try. Try replacing the InsertComment query with the following:

```auto
-- MySQL ver
INSERT INTO PerspectiveComments(note, panelId, sticky, tStamp, userName, attachmentType)
VALUES (:note, :panelId, :sticky, :tStamp, :userName, :attachmentType);
SELECT LAST_INSERT_ID();

```

The goal is to output the ID of the last inserted row from the query. If this solution doesn’t work hopefully this helps point you in the right direction, at least.

---

<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:** [June 3, 2022, 10:01am UTC](https://forum.inductiveautomation.com/t/perspective-comments-panel/32242/17 "2022-06-03T10:01:58Z")

</div>

> [@kirsten.chambers](#):
>
> The goal is to output the ID of the last inserted row from the query

Fwiw theres an arg to try to return the row ids updated from the runPrepUpdate function, although there's a caution that not all DB's support it. Can't tell you what arg it is atm as docs are offline
