I want to fetch a measurement that has string(numeric value) and convert it into integer to use absolute function on it.
I am already fetching the values and plotting on the graph but the values are negative, so I want to use abs function but it the field was declared as string in database so cant really perform the function.
Can u suggest query to convert a string into unsigned integer
I’m pretty sure the options available to you are primarily going to be
determined by which back-end data store you are using.
The more comprehensive its query language (SQL etc) is, the better.
Where is your data?
Antony.
my data source is influx time series db
If it’s InfluxDB 1.8, I suspect you’re out of luck - your best bet there is to
get numeric data inserted as numerics and not strings, in the first place.
https://docs.influxdata.com/influxdb/v1.8/query_language/explore-data/
#cast-operations specifically says “InfluxDB supports casting field values from
integers to floats or from floats to integers.” It also says “InfluxDB returns
no data if the query attempts to cast an integer or float to a string or
boolean.” therefore I suspect the reverse is also true.
If it’s InfluxDB 2.0, it has a much more powerful query language, however I’m
not an expert in it (I still use InfluxDB 1.8). Someone else here, or
alternatively someone on the InfluxDb list / forum mayb better be able to help
you.
Antony.