# Getting the transformed data into condition in kibana watcher

**URL:** <https://discuss.elastic.co/t/getting-the-transformed-data-into-condition-in-kibana-watcher/206326>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [November 4, 2019, 4:33am UTC](https://discuss.elastic.co/t/getting-the-transformed-data-into-condition-in-kibana-watcher/206326 "2019-11-04T04:33:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shan\_Chathusanda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shan_chathusanda/32/55382_2.png) [@Shan\_Chathusanda](https://discuss.elastic.co/u/Shan_Chathusanda)\
**Post date:** [November 4, 2019, 4:33am UTC](https://discuss.elastic.co/t/getting-the-transformed-data-into-condition-in-kibana-watcher/206326/1 "2019-11-04T04:33:00Z")

</div>

Hi,

I am currently developing a kibana watcher alert and I am comparing two values to generate an email if the condition comes true. For that I calculated an average value and it comes with many decimal places (nearly 20). I found that it can be rounded into several decimal places from transform section. I have tried it and I got the results as well. Now I need to add those transformed results to the condition section. I have tried ctx.transform.payload to access the transformed payload but it results a null. So is there anything I am missing when accessing the transformed payload?

Regards.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 4, 2019, 9:56am UTC](https://discuss.elastic.co/t/getting-the-transformed-data-into-condition-in-kibana-watcher/206326/2 "2019-11-04T09:56:33Z")

</div>

a transform is always executed **after** the condition.

---

<div class="post-metadata">

**Author:** ![Shan\_Chathusanda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shan_chathusanda/32/55382_2.png) [@Shan\_Chathusanda](https://discuss.elastic.co/u/Shan_Chathusanda)\
**Post date:** [November 4, 2019, 9:58am UTC](https://discuss.elastic.co/t/getting-the-transformed-data-into-condition-in-kibana-watcher/206326/3 "2019-11-04T09:58:24Z")

</div>

Hi @spinscale,

Thanks for the quick reply. Is there any way to round the aggregation payload before the condition and compare those rounded data inside the condition?

Regards.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 4, 2019, 10:06am UTC](https://discuss.elastic.co/t/getting-the-transformed-data-into-condition-in-kibana-watcher/206326/4 "2019-11-04T10:06:23Z")

</div>

Can you maybe explain, why you want to compare a rounded result vs a non rounded one? Interested behind the use-case here and why that is necessary.

That said, you can execute any logic in the script condition and of course round to anything you want before that as well.

---

<div class="post-metadata">

**Author:** ![Shan\_Chathusanda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shan_chathusanda/32/55382_2.png) [@Shan\_Chathusanda](https://discuss.elastic.co/u/Shan_Chathusanda)\
**Post date:** [November 4, 2019, 10:10am UTC](https://discuss.elastic.co/t/getting-the-transformed-data-into-condition-in-kibana-watcher/206326/5 "2019-11-04T10:10:24Z")

</div>

This is the use case. The average value from the aggregation contains many decimal places (nearly 20) but I need that average value in three decimal places and compare it with another value. This is the reason that I want to round the average value. Please feel free to ask for any clarifications.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 2, 2019, 10:10am UTC](https://discuss.elastic.co/t/getting-the-transformed-data-into-condition-in-kibana-watcher/206326/6 "2019-12-02T10:10:31Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
