Flux query: _field has slash in name, cannot get value

Hello,
I am wondering how I can get the value out of a _field which has slashes in his name, ie:

r._field == “status_information/last_state_change/days”

my query looks like the following and I want to calculate a new column based on days * 86400 + hours * 3600, etc to get the number of seconds and graph it. As you may notice, I am not able to get the value out of >> r.status_information/last_state_change/days

Any Ideas? I am hunting cisco telemetry data, bfdsessionuptime…
Thanks in advance, best regards, Tom

from(bucket: "telemetry")
  |> range(start: -5m)
  |> filter(fn: (r) => r._measurement == "Cisco-IOS-XR-ip-bfd-oper:bfd/session-details/session-detail")
  |> filter(fn: (r) => r.destination_address =="192.168.1.3")
  |> filter(fn: (r) => (
          r._field == "status_information/last_state_change/days" or
          r._field == "status_information/last_state_change/hours"
         )
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> map(fn: (r) => ({ r with
      uptimeseconds: float(v: r.status_information/last_state_change/days * 86400.0) + float(v: 
      r.status_information/last_state_change/hours * 3600.0)
  }))

@ToWo You can’t use dot notation if there are special characters or white space characters in your column name. You need to use bracket notation:

from(bucket: "telemetry")
  |> range(start: -5m)
  |> filter(fn: (r) => r._measurement == "Cisco-IOS-XR-ip-bfd-oper:bfd/session-details/session-detail")
  |> filter(fn: (r) => r.destination_address =="192.168.1.3")
  |> filter(fn: (r) => (
          r._field == "status_information/last_state_change/days" or
          r._field == "status_information/last_state_change/hours"
         )
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> map(fn: (r) => ({ r with
      uptimeseconds: float(v: r["status_information/last_state_change/days"] * 86400.0) + float(v: r["status_information/last_state_change/hours"] * 3600.0)
  }))

@scott exactly what I was looking for, have had looked in to the samples for hours and the beginners guide fits best. thank you. Please allow one more question on this, I want to extend the filter r.destination_ipaddress == “192.168.xx” to a variable which than can be chosen at runtime from an ip-list ( ip address values to choose can be picked up by a distinct query to the destination_address). How would one start?
thanks in advance,
best regards,
Tom

@ToWo If you’re using InfluxDB Cloud or InfluxDB OSS 2.0, you can create a custom dashboard variable that lists all of the potential IPs.

The InfluxDB stores all dashboard variables in a v record that get’s append to all dashboard cells, so to use a variable in a dashboard query, you just use the v.variableName (or v["Variable Name"]) syntax:

from(bucket: "telemetry")
  |> range(start: -5m)
  |> filter(fn: (r) => r._measurement == "Cisco-IOS-XR-ip-bfd-oper:bfd/session-details/session-detail")
  |> filter(fn: (r) => r.destination_address == v.IP)
  |> filter(fn: (r) => (
          r._field == "status_information/last_state_change/days" or
          r._field == "status_information/last_state_change/hours"
         )
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> map(fn: (r) => ({ r with
      uptimeseconds: float(v: r["status_information/last_state_change/days"] * 86400.0) + float(v: r["status_information/last_state_change/hours"] * 3600.0)
  }))

@scott Perfect! Thank you very much for this, now it fits all together,
cheers,
Tom

@ToWo No problem. Happy to help!