Is There a Way Populate a List of Things [Nightly Rates] with the return value of a "function" (essentially) that is another list of things [the date for the night in question]?

I’m continually frustrated by this and maybe I’m just missing something. I’m trying to do a Rate Quote (you know, like in a hotel or vacation rental or similar).

So, I have a list of dates (this is a list of every day – as a date – between the start of a booking and the end of a booking, and yes data format is dates). So if you’re tryiing to book 5/21/18 - 5/24/18, this list looks like:

5/21/18, 5/22/18, 5/23/18, 5/24/18 right? (It’s stupid that I had to create a Webtask API thingy to build such a list, but it’s the only quick way to do it.

Now, what I want to do is just build a similar-sized list where the rate for each night is the result of a lookup (actually, one of 3 lookups, depending on what sort of rates might be defined). And, of course, I can easily build a a Repeating Group based on those dates that then has a text element in each cell that displays the correct rate.

But there seems to be no “loop-free” way (that I can figure out) to set a nightly rate list and, hence, SUM the values to display an overall cost.

Like, all I want to do is something like this: Set list “Nightly Rates” to be a List of Numbers that are the result of “Look up nightly rate for (this date)”.

The thing is, I can never seem to get a LIST back for such an operation. I can only do this one item at a time. And since there’s no LOOPING (except via “Schedule an API Workflow on a List” – which, by the way is way too slow and also doesn’t always complete properly for reasons I cannot sort out), I just can’t make it happen.

One specific example:

A thing one is trying to book may have Custom Rate periods defined. If so, the nightly rate should be:

Do a Search for Custom Rates constrained by “Custom Rate’s Listing = this listing” (<-- this, by the way, returns a list, right?) but also by “Custom Rate’s Date Range contains point (this Date)”. When you add that second constraint (or even just that constraint by itself) Bubble complains of course because the (this Date) thing is actually a LIST OF DATES.

It’s like you can’t nest these two things. I keep going around and around on this. It kind of looks like I need to write YET ANOTHER Webtask to walk through the list of dates and ping my application for the rate on each night and then return those things.

This is insanely goofy, of course, as the CPU usage to do that MUST be greater than the CPU usage to simply allow me to do that directly in Bubble.

Is there a best practices way to do this???

Thanks!
Keith

This topic was automatically closed after 70 days. New replies are no longer allowed.