Rename value is not working

Hi All, I’m using influxDb v2 and I can’t rename a value to a friendly one:

image

The filter is: |> filter(fn: (r) => r["_field"] == “ifInBits_rate” or r["_field"] == “ifOutOctets_rate”)

I tried the following map but it did not work:

|> map(fn: (r) => ({
r with name:
if r._field == “ifInBits_rate” then “In Bits”
else “Out Bits”
})
)

Any ideas?

1 Like

Hi, try this map command:

|> map(fn: (r) => ({ r with _field: if r._field == “ifInBits_rate” then “In Bits” else “Out Bits” }) )

You have to specify the column name which needs to be replaced, in your case the _field column.

Best regards

2 Likes

It worked. Thanks a lot for the quick response