On Tuesday, September 27, 2016 at 9:42:05 PM UTC+1, Ross McDonald wrote:
> Is this just for display purposes (using it in a message), or do you want to
> store the value like that? You can use `printf` in a template for changing
> the precision, for example:
>
> ```
>
> |alert()
>
> .message('Percentage value is {{ index .Fields "value" | printf "%0.2f" }}%')
> ```
>
>
> I'm not sure if there's a way to store the value that way, though.
>
>
>
> On Mon, Sep 26, 2016 at 10:35 PM, guotao Yao <[email protected]> wrote:
>
> Hi all,
>
>
> The next are statements of tick script, I want to get a percentage value.
>
>
> ```
>
> |eval(lambda: float(100) * ("system.value" / "total.value"))
> .as('value')
> ```
>
>
> Result value:
> 6.3636355999903165
>
>
>
> I want to get a value like this: 6.36.
>
>
> In other words, I need to control the precision of the float value.
>
>
> What should I do?
>
>
> Thanks!
>
>
>
>
> --
>
> Remember to include the InfluxDB version number with all issue reports
>
> ---
>
> You received this message because you are subscribed to the Google Groups
> "InfluxDB" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
>
> To post to this group, send email to [email protected].
>
> Visit this group at https://groups.google.com/group/influxdb.
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/influxdb/2a3d1590-fc14-4842-a1e1-b569c2925bec%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
how to store this calculated percentage in influxdb using tick script?
--
Remember to include the InfluxDB version number with all issue reports
---
You received this message because you are subscribed to the Google Groups
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/fd47b5b3-0e27-4d79-bcd1-c3f76c79cd0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.