Filter: compare two attributes

(Marco Govoni) #1

How can I compare two attributes?

Example:

Bot - New Message —> Filter:

OUTPUT: {{bot_new_message.attributes__sim-dati}}
IS GREATER THAN
VALUE: {{bot_new_message.attributes__sim-voce}}

It doesn’t work :frowning:

Filters: using previous action's outputs as value
(John Jackson) #2

No, sorry, we don’t yet have outputs in the ‘value’ box. Instead, you could maybe use the code service to compare them (obviously you’d need to know a little JavaScript).

1 Like
(Marco Govoni) #3

thanks John. Have you got a little example so I can copy it?
Sorry but my skill on programmer in JavaScript are… zero :frowning2:

thank you

(John Jackson) #4

Sure, you can use this to compare 2 attributes named foo and bar:

If they are identical, the output from the code will be true, and if they are different, it will be false.

To do greater than or less than, use inputs.foo <= inputs.bar etc…

Hope that’s helpful! :slight_smile:

1 Like
(Szymon) #5

Hi!
Will there be any updates to this mechanism down the roadmap? I’m using a Webhook service that requires filtering (via comparing 2 values sent through the Webhook), otherwise it’s eating too many interactions…

Please let me know if there’s a way to do that, filtering in code is not an option (did that already, but the interactions are fired anyway).

Cheers,
Szymon

(John Jackson) #6

Yes we will be enabling this soon - certainly we’d like to do it. We know how handy it will be, just we have to prioritize certain things. Thanks for your patience.

1 Like
(Szymon) #7

Thanks John, will be waiting!

(Ollie) #8

Hey @johnjackson,

A little helping hand for a Javascript rookie…

I’m trying filter an action based on whether Output X is greater than Output Y OR whether Output Y contains a certain letter.

I’ve used the code you super-helpfully outlined above to do the first part, but I’m not sure how to add the second part.

Can you help?

Thank you!

(Szymon) #9

@johnjackson do you have any updates on this? cheers!

(John Jackson) #10

Actually we released this a few weeks back: