# How to get the highest value from different apps

**URL:** <https://community.homey.app/t/how-to-get-the-highest-value-from-different-apps/92956>\
**Category:** Questions & Help\
**Created:** [October 27, 2023, 10:30am UTC](https://community.homey.app/t/how-to-get-the-highest-value-from-different-apps/92956 "2023-10-27T10:30:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dennis\_H74](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dennis_h74/32/11177_2.png) [@Dennis\_H74](https://community.homey.app/u/Dennis_H74)\
**Post date:** [October 27, 2023, 10:30am UTC](https://community.homey.app/t/how-to-get-the-highest-value-from-different-apps/92956/1 "2023-10-27T10:30:19Z")

</div>

Hi

I use 3 weather apps.  
All 3 show different values and all 3 have totally inaccurate values on some days for wind guts.

I want homey to check the wind gust values for each app and then use the highest value.

I have no clue on how to do that.

Hope someone can help.

---

<div class="post-metadata">

**Author:** ![Theo\_de\_Koning](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/theo_de_koning/32/136062_2.png) [@Theo\_de\_Koning](https://community.homey.app/u/Theo_de_Koning)\
**Post date:** [October 27, 2023, 5:33pm UTC](https://community.homey.app/t/how-to-get-the-highest-value-from-different-apps/92956/2 "2023-10-27T17:33:39Z")

</div>

In short test first 2 values who is greater and then testing that to the last value.  
You may used \>= for clarity but if 2 are equal then the result is the same.

```auto
Value 1 = 3
Value 2 = 8
Value 3 = 7
                                        yes .. Result = Value 1
                 yes .. Value 1> Value 3
                                         no .. Result = Value 3
Value 1 > Value 2
                                        yes .. Result = Value 2
                  no .. Value 2> Value 3
                                         no .. Result = Value 3

```

1. No
2. Yes  
Result = 8

---

<div class="post-metadata">

**Author:** ![Dennis\_H74](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dennis_h74/32/11177_2.png) [@Dennis\_H74](https://community.homey.app/u/Dennis_H74)\
**Post date:** [October 27, 2023, 5:37pm UTC](https://community.homey.app/t/how-to-get-the-highest-value-from-different-apps/92956/3 "2023-10-27T17:37:45Z")

</div>

Thanks theo

I get the idea … now i need to get this in an advanced flow

Thanks for the inspiration 👍

---

<div class="post-metadata">

**Author:** ![Theo\_de\_Koning](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/theo_de_koning/32/136062_2.png) [@Theo\_de\_Koning](https://community.homey.app/u/Theo_de_Koning)\
**Post date:** [October 28, 2023, 3:43pm UTC](https://community.homey.app/t/how-to-get-the-highest-value-from-different-apps/92956/4 "2023-10-28T15:43:12Z")

</div>

Have you found a solution for your question? 😉

---

<div class="post-metadata">

**Author:** ![Dennis\_H74](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dennis_h74/32/11177_2.png) [@Dennis\_H74](https://community.homey.app/u/Dennis_H74)\
**Post date:** [October 28, 2023, 6:41pm UTC](https://community.homey.app/t/how-to-get-the-highest-value-from-different-apps/92956/5 "2023-10-28T18:41:16Z")

</div>

Did not have much time so far 🤷

---

<div class="post-metadata">

**Author:** ![Theo\_de\_Koning](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/theo_de_koning/32/136062_2.png) [@Theo\_de\_Koning](https://community.homey.app/u/Theo_de_Koning)\
**Post date:** [October 28, 2023, 7:13pm UTC](https://community.homey.app/t/how-to-get-the-highest-value-from-different-apps/92956/6 "2023-10-28T19:13:59Z")

</div>

Because I know now that you use advanced flow I found it a nice test for myself.

Var 1 - Var 3 are your wind guts values.  
Variable **Result** get the highest of those 3.

Look to the place of Var 3 in the tests .  
This way you have only 3 end carts needed.

 ![](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/d/8d4b14d60edf3c812a1f987d91084533d7f364f8.jpeg)

---

<div class="post-metadata">

**Author:** ![Caseda](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/caseda/32/138695_2.png) [@Caseda](https://community.homey.app/u/Caseda)\
**Post date:** [October 28, 2023, 7:36pm UTC](https://community.homey.app/t/how-to-get-the-highest-value-from-different-apps/92956/7 "2023-10-28T19:36:13Z")

</div>

If you don’t mind using the HomeyScript app, then that’s a relatively easy solution too, and is infinitely expandable, not just 2 or 3 tokens, just separate the tokens with a semicolon (`;`).

Card used:  
`Run [code] with [argument] and return Number-tag`  
 ![screenie](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/8/08d7467b2ef13ffbe1cf7f06b4aa3459ff9f0a89.jpeg)

Code used:

```auto
// Max()
const values = args[0].split(';').map(str => Number(str));
return Math.max(...values);

```

Or if you rather don’t want to use another app, you can also save the maximum value in a logic variable first and trigger the rest of your flow on that change:

Card used:  
`Calculate [variable] as [text]`  
 ![screenie2](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/3/83e8cce454a2ae0725cd813575482eff1b8f6d9a.jpeg)

Calculation used:  
`{{ max([wind1], [wind2], [wind3]) }}`
