# How to convert an array to a text - NodeRED read from MySQL to be sent to Telegram

**URL:** <https://discourse.nodered.org/t/how-to-convert-an-array-to-a-text-nodered-read-from-mysql-to-be-sent-to-telegram/33102>\
**Category:** General\
**Created:** [20 September 2020 10:50 UTC](https://discourse.nodered.org/t/how-to-convert-an-array-to-a-text-nodered-read-from-mysql-to-be-sent-to-telegram/33102 "2020-09-20T10:50:15Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [22 September 2020 17:22 UTC](https://discourse.nodered.org/t/how-to-convert-an-array-to-a-text-nodered-read-from-mysql-to-be-sent-to-telegram/33102/21 "2020-09-22T17:22:54Z")

</div>

> [@CesarLeiton](#):
>
> From the occupation node we have this output (it is ok like this, we could adapt it at the end).

Hi .. it looks ok. i dont have any experience with Telegram. Only one way to find out 😉

By the way .. why you get a negative number for the "Remaining places" ?  
Did you change the test number of 24 to your hall's maximum seat capacity ?

```auto
let remainingSeats = 24 - seats;

```

---

<div class="post-metadata">

**Author:** ![CesarLeiton](https://avatars.discourse-cdn.com/v4/letter/c/90ced4/32.png) [@CesarLeiton](https://discourse.nodered.org/u/CesarLeiton)\
**Post date:** [22 September 2020 18:12 UTC](https://discourse.nodered.org/t/how-to-convert-an-array-to-a-text-nodered-read-from-mysql-to-be-sent-to-telegram/33102/22 "2020-09-22T18:12:24Z")

</div>

Thank you very much again.

Regarding with your question, you are right we should not have negative number there. The goal would be to show the occupation of one place as well as the "remaining places". The table is coming from a IP stream camera which is "counting" the number of people in a place with ml in Python, and then the output would be a table with the number of people by zone.

And we would like to send a message to Telegram showing the total number of people and also the remaining spare places to help the people to decide whether they want to go to the shop or not. 🙂

Thanks again for your support. Let´s wait if anyone else could help us with the txt message to be sent through a Telegram sender to a mobile phone.

---

<div class="post-metadata">

**Author:** ![CesarLeiton](https://avatars.discourse-cdn.com/v4/letter/c/90ced4/32.png) [@CesarLeiton](https://discourse.nodered.org/u/CesarLeiton)\
**Post date:** [22 September 2020 18:38 UTC](https://discourse.nodered.org/t/how-to-convert-an-array-to-a-text-nodered-read-from-mysql-to-be-sent-to-telegram/33102/23 "2020-09-22T18:38:43Z")

</div>

At the end I found it. I mixed the two functions in only one, and changed the type of "msg.payload" type from "text" to "message".

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/b/7b15f5cfec5a4360a7fd0113dd2992b202df395c.png)

Now we receive the message in two different Telegram chats (private and group):

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/f/ff7ad41a2bcbcc1a723ae34950b78a940e2bd4c6.png)

Thanks all,

---

<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:** [21 November 2020 18:38 UTC](https://discourse.nodered.org/t/how-to-convert-an-array-to-a-text-nodered-read-from-mysql-to-be-sent-to-telegram/33102/24 "2020-11-21T18:38:43Z")

</div>

Closed on 21 November 2020 18:38 UTC

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

[Previous page](https://discourse.nodered.org/t/how-to-convert-an-array-to-a-text-nodered-read-from-mysql-to-be-sent-to-telegram/33102.md?page=1)
