Best answer

Comparing more than two variables and then filtering

  • 29 March 2020
  • 4 replies
  • 46 views

Userlevel 3

I did find the solution offered in Comparing Two Variables very helpful.  However I have a related question which involves filtering on the results of more than two variables.

Scenario:

Using AcuityScheduling as the Trigger, I am adding various bits of information from an appointment and adding them to Storage by Zapier and that all works. Where it gets a bit tricky is that sometimes one of the participants has the appointment on a different day.  Think calls in:

  1. Vancouver: Pacific Time 
  2. New York: Eastern Time,
  3. London: GMT+1
  4. Kuala Lumpar or Korea (Asia).  

In the above scenario the call in Korea is on the next day to everyone else.

Initial objective:

The notification email that goes out needs to have both dates on it:

Date 1

  • TimeZone: 1 
  • TimeZone: 2
  • TimeZone: 3

Date 2

  • Timezone:4

Current setup in Zapier:

I compare two of the dates (1 & 2) to see if they are the same/different by (spread-sheet formula)

if("item in one place"="{{Item in another place}}","same","different")

Than I use the same formula to separately compare the other two dates (3 & 4) to see if they are the same/different.

I’ve then set up a path that’s based on all 4 being the same.

Now I need a path that’s based on only 3 being the same (Date 1) and the other (Date 2) being different.

Ultimate Question:

Is there a way to compare all 4 variables and rather then have the output be “same” or “different” the output is the two separate dates?

Or maybe, the next step would be to ask Formatter to add I day to the “same” date to make it “different”, adding that new date to the appropriate place in Storage by Zapier in the next step.

Suggestions or helpful comments would enhance my learning, so thank you in advance!

Amelia

PS: not a coder or a developer, and I will say that I can understand the structure of a piece of code, even if I can’t write it.

icon

Best answer by amelia_pb 4 April 2020, 22:02

Ok, I’m just adding this in for completeness: I found the Zapier answer that I needed without having to bend my mind around Node.js.

 

https://community.zapier.com/tips-and-inspiration-5/how-to-use-dynamic-fields-in-filters-211

 

My thanks to @paulminors  for his awesome video that turned on the lights for me: 

 

https://www.loom.com/share/7408dca840a24a439baff062ac0a586a

View original

This topic has been closed for comments

4 replies

Userlevel 3

Alright: this is what I’ve done so far with this Zap: Where both sets of call dates are the same, I’ve set up a step that proceeds on that basis.

I set up a step for where the dates are different and when that step is triggered, I send myself a message in Slack so that I can attend to it manually for the time being. (Since this scenario is less likely, I figured I’d do it this way while I investigate other options).

What I’d still like to know is if there is a way to compare all 4 dates using a spread-sheet formula such as this one?  This doesn’t work of course. Is this more easily accomplished by using javascript? (This would put me into scary territory - but I’m game to learn!)

if("{{date1}}"="{{date2}}"="{{date3}}"="{{date4}}","same","different")

I’d also love to figure out a way to determine which one is different since they each have different valus (and names) …..

Userlevel 3

Ok, so I ended up doing most of this processing within AirTable by creating a new column that compared the dates by timezone using the following formula;

IF(
  DATETIME_FORMAT(SET_TIMEZONE({Call 1}, {CTZ1}), 'DD') = 
  DATETIME_FORMAT(SET_TIMEZONE({Call 1}, {CTZ2}), 'DD'),
  "same",
  "not same"

The information in the output field lets me better determine which of the two dates is different and I can add that information to Storage by Zapier, and pull it from there.  I also had a go at using the code block - and got partway there, but wasn’t able to get the syntax to work.  In general, I don’t have to check if the other two dates match because they usually do.

Some help on the syntax for the code block would be good though!

 

Comments anyone?

 

Userlevel 3

Ok, I’m just adding this in for completeness: I found the Zapier answer that I needed without having to bend my mind around Node.js.

 

https://community.zapier.com/tips-and-inspiration-5/how-to-use-dynamic-fields-in-filters-211

 

My thanks to @paulminors  for his awesome video that turned on the lights for me: 

 

https://www.loom.com/share/7408dca840a24a439baff062ac0a586a

Userlevel 7
Badge +11

Hi @amelia_pb  That’s some rockstar troubleshooting, nice work! 🙌