Forum Academy Marketplace Showcase Pricing Features

Date range support for API?

Does the bubble search constraint for the api support the Date Range method?

Hey,

This might be what you’re looking for.

https://bubble.io/reference#API.get_api.search_call.search_constraints

I tired that but did not work for me, so I just ended up making a workflow endpoint instead of using the GET request. Now I am trying to figure out the most efficient way to compare to a date field with the current date & time variable… it seems like it takes the time into factor as well. Anyway to compare the dates only excluding the time? I don’t want to use the filter or advance options because they slow down the response time…

Isn’t a range something that is greater than one thing and less than another thing?

I cant find a efficient way to compare a date field with the current date so I thought I would run a search using the range by modifying today’s date to a range of 5/25/19 00:00:00 to 5/25/19 23:59:59

Looks like Bubble’s internal API supports the following constraint:

What you’re trying to achieve?

I need to run a search query which will take a given date and compare it with a date field of 10,000+ things in DB. The date field of these things are date & time, so whenever I compare it to a date only using the equal operator it always gives me a False, due to the time value being part of the date field in bubble.

In one Api call I need to run 4 of these search queries and get a total count of the matched records and then return it as a response therefor I need to make it as efficient as possible so it doesn’t take to long.

1 Like

Do you need to compare years, months, and days only?

If yes, you can create the following additional fields:

  • Year | number
  • Month | number
  • Day | number

Now, you’re able to use them as the constraints.

Are you saying to create 3 additional fields of day,month, year for each thing in the database?

Yes. You will be able to query your things faster.

This thing is a “shipment” and a shipment record already has a lot of data fields attached to it like name, phone number, address, weight… almost 40 fields attached to it. Don’t you think it will slow down all other search queries if I add 3 more fields to it?

I don’t think that the 3 additional fields will slow down the process taking into account that you already have 40 fields.

It will slow down the process in the case if the fields will contain huge data.

BTW, please try to find a way, which will reduce the number of the fields.

Sorry to intrude. But you said that using a filter slows down the response. I have a call and I only want it to display if a certain data is "yes"Do you know how to make it faster? I really noticed a certain delay after the filter and it bothers

Does the api you are using provide you with parameters for filtering directly on the call?

only on this call no

How many items are you retrieving on a average from the api? Filtering will only slow things down if the returned data from the api is in 1000+

se for por linha chega 34k. usando o filtro reduz para 99% porque passa a ser exibido apenas o que for verdadeiro e isso gira em torno de no máximo 100

“ if it’s by line it gets 34k. using the filter reduces it to 99% because only what is true is displayed and this is around a maximum of 100”

I translated that :blush:

If your only filtering on 100 items then filtering will slow it down by a very small factor. You might need to look at other things to figure out what’s slowing it down.

Sorry I’m translating into English. To be clearer my filter checks if the data is yes it displays in the RG. Data is reproduction if the client is reproducing it displays