T
Typebot12mo ago
POne0620

Variables Comparison

I have 7 variables used for lead scoring. At the end of the flow, I meed to determine which variable has highest score and declare the result. Whats the best way to do this?
2 Replies
Baptiste
Baptiste12mo ago
You could add a Set variable block with that content:
[{{Score 1}}, {{Score 2}}, {{Score 3}}].reduce((max, curr) => {
if(curr > max) return curr
return max
}, 0)
[{{Score 1}}, {{Score 2}}, {{Score 3}}].reduce((max, curr) => {
if(curr > max) return curr
return max
}, 0)
POne0620
POne0620OP11mo ago
Awe awesome. Thnk you.

Did you find this page helpful?