# Error trying to edit a tag event script

**URL:** <https://forum.inductiveautomation.com/t/error-trying-to-edit-a-tag-event-script/9788>\
**Category:** Ignition\
**Created:** [March 10, 2015, 3:11pm UTC](https://forum.inductiveautomation.com/t/error-trying-to-edit-a-tag-event-script/9788 "2015-03-10T15:11:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [March 10, 2015, 3:11pm UTC](https://forum.inductiveautomation.com/t/error-trying-to-edit-a-tag-event-script/9788/1 "2015-03-10T15:11:17Z")

</div>

While adding a few lines to an existing tag event script I got the following error on the console:

> [@](#):
>
> 10:02:53 AM TagStore Error modifying tags
> 
> java.sql.SQLDataException: data exception: string data, right truncation  
> at org.hsqldb.jdbc.Util.sqlException(Unknown Source)  
> at org.hsqldb.jdbc.Util.sqlException(Unknown Source)  
> at org.hsqldb.jdbc.JDBCPreparedStatement.fetchResult(Unknown Source)  
> at org.hsqldb.jdbc.JDBCPreparedStatement.executeUpdate(Unknown Source)  
> at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)  
> at com.inductiveautomation.ignition.gateway.sqltags.tagproviders.internal.InternalTagStore.storeEventScripts(InternalTagStore.java:1567)  
> at com.inductiveautomation.ignition.gateway.sqltags.tagproviders.internal.InternalTagStore.modifyTag(InternalTagStore.java:833)  
> at com.inductiveautomation.ignition.gateway.sqltags.tagproviders.internal.InternalTagStore.modifyTags(InternalTagStore.java:753)  
> at com.inductiveautomation.ignition.gateway.sqltags.providers.AbstractStoreBasedTagProvider.editTags(AbstractStoreBasedTagProvider.java:714)  
> at com.inductiveautomation.ignition.gateway.sqltags.providers.RedundantProviderWrapper.\_editTags(RedundantProviderWrapper.java:73)  
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)  
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)  
> at java.lang.reflect.Method.invoke(Unknown Source)  
> at com.inductiveautomation.ignition.common.messages.ReflectiveInvokeMessage.execute(ReflectiveInvokeMessage.java:41)  
> at com.inductiveautomation.ignition.gateway.sqltags.providers.RedundantProviderWrapper$ConfigRedundancyMessageListener.receiveCall(RedundantProviderWrapper.java:190)  
> at com.inductiveautomation.ignition.gateway.redundancy.QueueableMessageReceiver.receiveCall(QueueableMessageReceiver.java:45)  
> at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl.dispatchMessage(RedundancyManagerImpl.java:667)  
> at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl$ExecuteTask.run(RedundancyManagerImpl.java:688)  
> at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:526)  
> at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)  
> at java.util.concurrent.FutureTask.run(Unknown Source)  
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)  
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)  
> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
> at java.lang.Thread.run(Unknown Source)  
> Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation  
> at org.hsqldb.error.Error.error(Unknown Source)  
> at org.hsqldb.error.Error.error(Unknown Source)  
> at org.hsqldb.types.CharacterType.castOrConvertToType(Unknown Source)  
> at org.hsqldb.types.CharacterType.convertToType(Unknown Source)  
> at org.hsqldb.StatementDML.getInsertData(Unknown Source)  
> at org.hsqldb.StatementInsert.getResult(Unknown Source)  
> at org.hsqldb.StatementDMQL.execute(Unknown Source)  
> at org.hsqldb.Session.executeCompiledStatement(Unknown Source)  
> at org.hsqldb.Session.execute(Unknown Source)  
> ... 25 more  
> less

I discovered that I had to remove a bunch of comments to get it to accept the edits. It is a pretty long script (about 100 lines). It seems there is some limit to the length of these scripts. Is it intentional?

Kurt

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 10, 2015, 3:15pm UTC](https://forum.inductiveautomation.com/t/error-trying-to-edit-a-tag-event-script/9788/2 "2015-03-10T15:15:18Z")

</div>

I’m not sure that it’s an intentional limit, but it appears to be 4096 characters right now 😕

This is just the default size of a string column in the internal DB; assuming there was no reason to keep it small we can increase the size in a later release no problem.

---

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [March 10, 2015, 3:32pm UTC](https://forum.inductiveautomation.com/t/error-trying-to-edit-a-tag-event-script/9788/3 "2015-03-10T15:32:12Z")

</div>

I guess you could always say you’re just trying to promote best practices by keeping routines small.

---

<div class="post-metadata">

**Author:** ![CTIJWatts](https://avatars.discourse-cdn.com/v4/letter/c/a4c791/32.png) [@CTIJWatts](https://forum.inductiveautomation.com/u/CTIJWatts)\
**Post date:** [September 28, 2015, 10:34pm UTC](https://forum.inductiveautomation.com/t/error-trying-to-edit-a-tag-event-script/9788/4 "2015-09-28T22:34:09Z")

</div>

Have you guys fixed this length in any of the newer versions?  
We’re running 7.7.4 an it is still limiting the number of characters.

In my case, I needed to be able to send an email when the value changes in the positive direction, ie., increases. Decreases are fine in this case. So I have a simple IF

```auto
if currentValue.value > previousValue.value:
```

Then I have a bunch of string concatenations to build several tables for the email. I’m also doing a couple of SQL queries to pull data out of the database (like to see who send the email too). There’s a couple of loops involved. In other words, it’s not complicated code. It’s just a lot of text.

I can understand why you’d want to enforce a limited amount of code on a tag change event, as these can be fired off pretty fast. However, if you’re going to limit the text then there needs to be some obvious message or a much more obvious error then:

[quote]An error occurred while committing, continue?  
Error message:  
data exception: string data, right truncation[/quote]

It took me a while of trial and error to figure out what was causing the error.

On a second note, if this text length can be easily worked around by calling a shared or project script, then why have it limited at all?
