# Variable is truncated after 1000 size

**URL:** <https://discourse.nodered.org/t/variable-is-truncated-after-1000-size/59200>\
**Category:** General\
**Created:** [1 March 2022 23:54 UTC](https://discourse.nodered.org/t/variable-is-truncated-after-1000-size/59200 "2022-03-01T23:54:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![calixtoemilio](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@calixtoemilio](https://discourse.nodered.org/u/calixtoemilio)\
**Post date:** [1 March 2022 23:54 UTC](https://discourse.nodered.org/t/variable-is-truncated-after-1000-size/59200/1 "2022-03-01T23:54:19Z")

</div>

simple loop  
var sql\_query = "DELETE from spot.clients WHERE clients\_id IN (";  
for (i=0;i\<to\_delete.length;i++){  
if (i \> 0) sql\_query += ",";  
sql\_query += to\_delete[i];  
}  
sql\_query += ")";  
msg.payload = sql\_query;

output gets truncated, while playing with fixed value for max loop, I noticed that while the string (sql\_query) is below 1000 chars it is not truncated.

Above that the string is truncated producing a SQL error

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [2 March 2022 00:00 UTC](https://discourse.nodered.org/t/variable-is-truncated-after-1000-size/59200/2 "2022-03-02T00:00:59Z")

</div>

If you mean it is truncated in the Debug sidebar, then yes, the Debug sidebar truncates the values it **displays** at 1000 characters. This prevents the debug sidebar/editor from being swamped with very large amounts of data.

The actual value of `msg.payload` will not be truncated. You can verify that by enabling the Debug node option to log to the system console as well - that output does not get truncated.

---

<div class="post-metadata">

**Author:** ![calixtoemilio](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@calixtoemilio](https://discourse.nodered.org/u/calixtoemilio)\
**Post date:** [2 March 2022 00:06 UTC](https://discourse.nodered.org/t/variable-is-truncated-after-1000-size/59200/3 "2022-03-02T00:06:41Z")

</div>

I understand that, but I get the error in the postgres node...makes sense?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [2 March 2022 00:07 UTC](https://discourse.nodered.org/t/variable-is-truncated-after-1000-size/59200/4 "2022-03-02T00:07:57Z")

</div>

Without any details of what error you are getting, or from where, it is very hard to say.

My suggestion about the Debug node was a guess based on the 1000 character limit you mentioned - as that is a known and expected behaviour of the Debug node.

If another node is giving an error, you need to tell us what the error actually is.

---

<div class="post-metadata">

**Author:** ![calixtoemilio](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@calixtoemilio](https://discourse.nodered.org/u/calixtoemilio)\
**Post date:** [2 March 2022 00:09 UTC](https://discourse.nodered.org/t/variable-is-truncated-after-1000-size/59200/5 "2022-03-02T00:09:22Z")

</div>

You are right, the console outputs the whole string, thanks!!!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 March 2022 00:10 UTC](https://discourse.nodered.org/t/variable-is-truncated-after-1000-size/59200/6 "2022-03-16T00:10:07Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
