Find a date in a range of dates - yes/no

Hello,

I’ve been struggling with this for the past few days reading all sorts of posts and potential solutions, but I’m not able to find a way to make it work.

Here is the situation:

I have the following Car Rides information:

  1. Date when the ride started.
  2. Date when the ride ended.
  3. Who was the driver of the ride.

I have the following Ads Records information:

  1. Date when the ad was running.
  2. Who was the driver of the car where the ad was running.

_

To my Car Rides DB I added a “yes/no” questioning If this Car Ride had advertising

I took the < range > of the Car Ride (ride start+ride end) and used “contains date” of my Add Records.

If it’s a match, then we save this info in the DB as a yes. Else it stays a no.

_

Where I got to now:

I can make this logic work if I compare the dates one by one with :first item.

But if I want to check and save in my DB date of a Car Ride with many Ads Records at once, I just can’t make it work.

Trying to build it in the Backend workflow, as a trigger that happens when I upload a .csv file of my Car Rides.

Hope this makes sense and someone has time to help me understand this.

Thanks so much!

You can create a recursive backend workflows that takes as input the list of dates of your Ad Records and iteratively checks whether there is an overlap. If there isnt, it reschedules itself with the next item on the list. If there is, just set the field to yes and stop the loop. The loop also needs to stop when it reaches the end of the list.

That being said, i would recommend linking the Ads to the Car Ride instead. In my opinion, Yes/No fields lead to loss of useful data, as a complex relationship is summarised by a simple bool.
Of course this depends on the functionality you are trying to achieve, as it does add a slight bit more complexity, but its usually worth considering.

2 Likes

Is it not easier to have a list of Ads field on the Car Rides that list all of the Ads Records pertaining to that car ride?

2 Likes

That would be indeed a great solution and thing to have, not sure how to do that doe just at a fist glance towards this idea.

It would then be easy to know which ride did run ads and which rides did not run ads.

But as an Extra i’d know how many specific ads were running.

I could do what you just said with the same method i think Nico mentioned above. Right?

Thanks so much for the answer, I started digging into recursive workflows to understand how I could achieve what you’ve said, cuz it sounds absolutely correct. Appreciate your time and effort, sir!

Well I don’t know what your CSV thing is about but when creating a Car Ride, do a search for Ads Recrods where the date is in range Car Ride and add the results of that search to the Ads list on the Car Ride.

1 Like

So my .csv is indeed creating the car rides with a workflow of upload data as .csv ->> then my next step is to make changes to a list and select “Results of step1” where I add extra info to the rides.

I could use the same logic but apply an “only when” condition I guess.