# Influx db string

**URL:** https://discourse.nodered.org/t/influx-db-string/87559
**Category:** Industrial
**Created:** [27 April 2024 22:42 UTC](https://discourse.nodered.org/t/influx-db-string/87559 "2024-04-27T22:42:39Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Gravino](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@Gravino](https://discourse.nodered.org/u/Gravino)
#### Post date: [27 April 2024 22:42 UTC](https://discourse.nodered.org/t/influx-db-string/87559/1 "2024-04-27T22:42:40Z")

</div>

hello,

connecting influxdb with plc siemens en opcua if i try to send a string i receive this error

```auto
unsupported input type for mean aggregate: string

```

this is what i'm sending

```auto
28/4/2024 00:37:29node: debug 38
ns=4;i=8 : msg : Object
object
_msgid: "0501bfd033f6f0e2"
payload: "pluto"
topic: "ns=4;i=8"
datatype: "String"
browseName: "Productie"
statusCode: object
serverTimestamp: "2024-04-27T22:37:31.799Z"
sourceTimestamp: "2024-04-27T22:37:31.799Z"

```

thi is the query in influxdb

```auto
from(bucket: "Test")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "prod")
  |> filter(fn: (r) => r["_field"] == "value")
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> yield(name: "mean")

```

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

can smeone help me please

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [28 April 2024 08:41 UTC](https://discourse.nodered.org/t/influx-db-string/87559/2 "2024-04-28T08:41:05Z")

</div>

Is the error appearing when you run the query to interrogate the database?

> [@Gravino](#):
>
> this is what i'm sending

What are you expecting to be written to the database when you give it that data? If you read the help text for the influxdb out node you will see that that data will cause the string "pluto" to be written, which I suspect is not what you want.

---

<div class="post-metadata">

### Author: ![Gravino](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@Gravino](https://discourse.nodered.org/u/Gravino)
#### Post date: [28 April 2024 10:26 UTC](https://discourse.nodered.org/t/influx-db-string/87559/3 "2024-04-28T10:26:33Z")

</div>

hello Colin  
i think this solved by taking away the last 2 rows of code in the query still testing i don't think i'm the one who can give solution here, maybe someone else with more skill can say if i did rght

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [28 April 2024 10:29 UTC](https://discourse.nodered.org/t/influx-db-string/87559/4 "2024-04-28T10:29:56Z")

</div>

> [@Gravino](#):
>
> i don't think i'm the one who can give solution here, maybe someone else with more skill can say if i did rght

I am trying to, but you have not answered the question

> [@Colin](#):
>
> What are you expecting to be written to the database when you give it that data?

---

<div class="post-metadata">

### Author: ![Gravino](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@Gravino](https://discourse.nodered.org/u/Gravino)
#### Post date: [28 April 2024 10:51 UTC](https://discourse.nodered.org/t/influx-db-string/87559/5 "2024-04-28T10:51:19Z")

</div>

sorry i wantend to read a name of production in grafana dashboard that i'm receiving from plc

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [28 April 2024 11:08 UTC](https://discourse.nodered.org/t/influx-db-string/87559/6 "2024-04-28T11:08:16Z")

</div>

> [@Gravino](#):
>
> i wantend to read a name of production in grafana dashboard that i'm receiving from plc

Ok, so for the example you were in fact attempting to write "pluto", in which case that is ok.

The error you were getting was telling you that you were trying to take the mean value of a set of strings (containing "pluto" for example) which obviously you can't do. For string type fields all you can do is read them as a set of records.

---

<div class="post-metadata">

### Author: ![Gravino](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@Gravino](https://discourse.nodered.org/u/Gravino)
#### Post date: [28 April 2024 12:46 UTC](https://discourse.nodered.org/t/influx-db-string/87559/7 "2024-04-28T12:46:26Z")

</div>

i'm electrician so i don't know so much abut coding i'm learning and sometimes i spend days to do something that other people do iin 1 second 🙂

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [28 April 2024 14:56 UTC](https://discourse.nodered.org/t/influx-db-string/87559/8 "2024-04-28T14:56:57Z")

</div>

It takes me forever to wire up a plug 🙂

---

<div class="post-metadata">

### Author: ![Hofes](https://avatars.discourse-cdn.com/v4/letter/h/a183cd/32.png) [@Hofes](https://discourse.nodered.org/u/Hofes)
#### Post date: [8 May 2024 10:14 UTC](https://discourse.nodered.org/t/influx-db-string/87559/9 "2024-05-08T10:14:01Z")

</div>

Try excluding the |\> aggregateWindow function in your Flux Query. Apparently the column of your value is not of type number (which can be aggregated) its rather of type string (which can't be aggregated).

---

<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: [7 July 2024 10:14 UTC](https://discourse.nodered.org/t/influx-db-string/87559/10 "2024-07-07T10:14:43Z")

</div>

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