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
> <https://groups.google.com/d/msgid/influxdb/2a3d1590-fc14-4842-a1e1-b569c2925bec%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAD8sRLDREnS2Oh_ET5%3DuQo8eDnryP5gs0-VhCkSgD-vfCuF_Og%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to