Filter on time

Hi

Need some help on a filter with time. I am trying to filter on the last 15 mins of a specific
I have a condition where there is a date and time coming from the data in the http call. I put a filter to look up the last 15 mins…
but it seems to bring in random data that came through the day…

Can anyone help or point in right place?

1 Like

I am not clear what you mean?

The now variable by default is formatted in D MMMM YYYY hh:mm (might be slightly off, just out of the top of my head). Which means you have to reformat it, to meet the structure you have in your http request data. Otherwise you’re filter will never handle it properly, because it’s looking at different time formats.

Something like this should get you in the right direction:

image
image

Thanks understood and make sense…

But for some reason, it is giving me only 1 record in this filter which is the first record from the http request.

Am I doing something wrong here?

@Elie

Just looking at your last post…

  1. You want to use the criteria “Later than or equal to”.
  2. Since you are parsing the incoming date, you do not need to format the “now”.

Looking back you your original post, what you had was correct except the “Later than or equal to”. (Assuming that you want to filter out everything not in the last 15 minutes.)

Also, if you are wanting to capture everything since your last run, this is not the best way to do this.

Jim - The Monday Man

@JimTheMondayMan
Thanks …but this still didn’t work
I did remove the format date of now and changed the filter to less than later than or equal too. it didnt work within the 15 min time frame so I changed it to hours to see what happens and then only got 1 again.

I am basically trying to capture anything new that has come through within the last scheduled 15 mins.
Is this what you meant also? If it is not the best way, what would you recommend?

Hi Elie,

Can you show us the data output of your HTTP call? And maybe a few screenshots of the filter inspector?

Thanks

Loic

@Elie

You need the parseDate() like you had in your first post.

formatDate() changes a “real” date into a string.
parseDate() changes a string into a real date.
By the way, “now”, and other “real” dates are measured to the 1/1000 of a second.

“now” (with or without additional operations) returns a “real” date.
Your incoming date is in a string.
When you compare the two, you need to compare “apples to apples”. AND, the date comparison operators REQUIRE (to function properly) that the values being compared are date/times (“real” dates, not strings or numbers)

To get “EVERYTHING”, you need to save the latest date/time that was read last. One way to do that is to use a datastore. The next time the process runs, you filter everything that is greater than that. Depending on the exact details, you might need to be able to overlap the data. Then specifically exclude previously processed data. The reason that this is important is because scheduling a scenario to run every 15 minutes is not exact. And, if there is a server problem, the difference could be more than just a few minutes.

Jim - The Monday Man

Aside from the above.

It’s also possible you’ll need to use the math operator subtract instead of the - before your 15
image

You need to make either side of comparison to a date format

@Mohamed_Jahar is correct.

I implied that you could use the date comparisons with formatted dates (strings). This is not correct. I have edited my previous post to correct the implication.

Jim - The Monday Man