Forum Academy Marketplace Showcase Pricing Features

Displaying data in between dates from 2 repeating group items

Hi All - I’m having trouble showing a certain set of data that is between 2 dates that are returned in a repeating group from an external API.

I’ve got a set of data in my Bubble DB that is time stamped, for example…

DateTime, Temperature
12/31/2015, 49
1/1/2016, 55
1/1/2016, 57
1/2/2016, 58

I am pulling down an array of info from an external API and placing it in a repeating group. Each of these rows are also timestamped. For example…

Event, DateTime
Event A, 12/31/2015
Event B, 1/1/2016
Event C, 1/4/2016

In my repeating group, I want to show the average of all the temperature records that fit between the current event and previous. So for my example, I would want to show on the row for Event C a value of 56.67 (avg of 55, 57, and 58).

I know I can put a constraint in my search for temperature records that are < than that of the current Event DateTime but I’m having trouble also constraining to records that are > than that of the previous row in the repeating group. I’ve been messing around with count #, index’s, etc but no luck yet. And the avg part is simple, I’m mainly just having trouble comparing/constraining with the previous (or next) record in a repeating group.

I’m not sure if this is the correct approach at all so any advice would be appreciated!

Thank you!

Mike

More simplified, is there any way to evaluate data in either the ‘next/previous’ row in a repeating group or reference to a specific index in a repeating group or something along those lines?

Still really looking for some help on this one. Running into it in numerous places in my projects. Seems like it should be simple. Has anyone come across this? I just need to grab some info from the next/previous row in a repeating group. I’ve tried all kinds of combinations of messing with cell index’s and item #'s but can’t seem to get anything to work.

Willing to pay or return the help in whatever way I can for anyone who has a solution!

Thank you!

Mike

Can you post your website?

Definitely:

If you scroll down to the Repeating Group Tracking Point (under Trip Details), I would want, for example, to display basically any information in one row that is contained in the next (or previous) row after it. I have a few fields in there now, one of them displaying a city. So, I’d want to have the current things city as well as the city in the next thing in the RG.

Thank you!

Mike

Hey I hope you’re still on. Why can’t you use two RG’s? One for a check-in facility and date time, and another with the check out?

Yup, I’m still here…not sure what you mean by using 2 RG’s though…could you mock it up?

If you know the time stamp of the “current” row … then you can do a search for the tracking point that has the highest timestamp below the current row’s timestamp and use :firstitem so it is returning just a single value. Use that to constrain the search for the sensor reading ?

@NigelG FTW! Yes, I think that will work just fine for now! I knew there had to be a simple enough solution, I just wish I would have thought of this weeks ago! Thank you!

Also huge thanks to @dylan.phillipslevine for helping me through more approaches!

sigh I’m just a simple man trying to make my way through a complex world. Nice job guys!