How to map alphanumeric variable in query

Hi,

I want to access alphanumeric variable in map function.

|> map(fn: (r) => ({ r with jsonStr: string(v: json.encode(v: {"wsiot_pred_152_1.4_prob_1.0":r.wsiot_pred_152_1.4_prob_1.0,"assetId": r.assetId,"s_id": 36,"a_id":[12]}))}))

So, in my case when i tried to create a task with that function its showing some error. like
image

I guess due to - r.wsiot_pred_152_1.4_prob_1.0 taking last value after dot is numeric.

So how can i access this kind of variable.

Thank you.

Hi @debnath,
I think you are stretching the limits of what was intended to be stored in a time series database but hopefully, we can help. So I would potentially split this out into a custom function and see if we can get it to work that way. Something like this:

import "json"
data = from(bucket: "inference_results")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) => r._measurement == "BW_Inference_results")
    |> filter(fn: (r) => r._field == "confidence")
    |> last()
    //|> yield(name: "_editor_composition")


jsonFunction = (jsonv1, jsonv2) => {
    temp = {"wsiot_pred_152_1.4_prob_1.0": jsonv1,"assetId": jsonv2,"s_id": 36,"a_id":[12]}
    json = json.encode(v: temp)
    string = string(v: json )
    return string
}


data 
  |> map(fn: (r) => ({ r with json: jsonFunction(jsonv1: r.host, jsonv2: r._value) }))

@Jay_Clifford Thanks a lot