List Shifter: Reverse, Rotate, Swap and ITERATE (Loop) Over Bubble Lists | Now Part of Floppy

I had to stop and take a break to re-evaluate my beliefs the moment the devil possessed you.

:hear_no_evil:

7 Likes

Iā€™d blame Loom for this, @jonl, but itā€™s more likely an issue with Chrome and/or the audio interface Iā€™m using. Seems like sometimes when I pause, it causes my audio interface to switch from 44.1kHz to 48kHz. And of course, this happens without me being able to tell. Kind of annoyingā€¦ But funny here.

Anyway, I hope this gets you going with Iteration with List Shifter! Let me know if you run into any other problems!

3 Likes

Next time you can start the video:

Hey hey itā€™s Keith from hellz :joy:

3 Likes

I would assume List Shifter Pro will be a plugin we can get in the Marketplace?

Oh, ha! Iā€™m so used to writing ā€œCalendar Grid Proā€ that I just compulsively added Pro hereā€¦

These features are in ā€œList Shifter Karma-Wareā€ plug-in thatā€™s freely downloadable. It doesnā€™t enforce a subscription, but ā€“ if you use it and find value in it ā€“ thereā€™s a contributions page at:

ā€¦ where you can pay what you want, or pick from several options. :slight_smile:

2 Likes

Hey Keith, thank you for the tutorials! Theyā€™re quite useful, especially when used in conjunction with other client side plugins. The feature Iā€™m more interested in is the iteration, but all of them seem interesting now that I went through the tutorials.

That said, I still canā€™t make iteration work without using ā€œshifted listā€ on the field List to iterate over, it says ā€œlist is emptyā€. Can it be used with the ā€œoriginal listā€ option?
I think so, else you would not add the option. Then, how? And yes, ā€œshifted listā€ works as expected, I change nothing when using the ā€œoriginal listā€ option.

My setup is this one:
Editor - https://bubble.io/page?type=page&name=testing_list_shifter&id=pdf-conjurer-testbed&tab=tabs-1
Run mode - https://pdf-conjurer-testbed.bubbleapps.io/version-test/testing_list_shifter?debug_mode=true

All it does is increment the number by one. Just a simple learning page.

On another thought, this plugin is quite prometheanā€¦ I mean, the gods here forbade us from client side looping and you just brought it back. I think youā€™ll end up alive and unchained because your implementation is clean, tidier (over a well defined list, instead of just linking two client side workflows) and non official, which makes it not a Bubble teamā€™s problem.

Anyway, any chance for us to get an ā€œiteration finishedā€ event? :smiley:
So we can freeze ourselves in a never ending loop by triggering the same ā€œbegin iterationā€ again. Just kidding, I promise Iā€™ll use it in a good way :slight_smile:

2 Likes

Hey, @vini_brito. Itā€™s possible youā€™ve discovered a bug with List Shifter. Original List should work as an iteration source, but maybe Iā€™ve made a boo boo. In the meantime, just use a List Shifter without any modifications and select Shifted List as the source. Thatā€™s the same thing.

However, I am using List Shifter in production with my Calendar Grid Pro plugin (well, my private version which is where I test new features) with no issues. (Though note that I use Shifted List always as the iteration source.) You can see a sample here ā€” check out my new GRUPZ Booking Widgetā€¦ it rocks out loud: https://grupz.com/vacation-rental-booking

When you select some dates in the booking widget, the calculation that happens is CG Pro iteration (to get the rate quote), followed by List Shifter iteration (to calculate fees). Works a treat.

On your other questions: Yes, I do see a use for an ā€œIteration Completeā€ event and Iā€™ll add that in a future update. I added that to CG Pro (private version) as it turns out thatā€™s fairly useful.

Best regards,
Keith

1 Like

Great! Thank you for taking the time to respond to that :slight_smile:

Yes, it totally works no problem whatsoever by just using the default, great in its glory.

And again thank you for the plugin!

1 Like

And BTW, Iā€™ll take a look at List Shifter later today. Adding iteration complete event is easy and if iterate over original list is bugged, thatā€™s a simple fix as well.

I spent the weekend doing MASSIVE updates to my grupz.com site (which generated a ton of new features for Calendar Grid Pro).

1 Like

So, there is already an iteration complete event. Update to the latest version, eh?

However, there is a bug in the iterate action when using original list. Iā€™ll fix it.

1 Like

OK, List Shifter version 1.3.0 is now available. This version fixes the bug that kept iteration over the Original List from working properly.

Please upgrade!

(Aside: Stupidest bug ever ā€“ I was simply setting the name of the list variable incorrectly when ā€œOriginal Listā€ was selected as the list source. Apparently, I had not tested that option! Dā€™oh! Apologies, my peeps.)

Shout out to @vini_brito for reporting that it never worked correctly!

6 Likes

High five! :raised_hand:
Thank you for it! All is fine now.

This makes life much easier with client side plugins.

2 Likes

This plugin :raised_hands: :raised_hands: :raised_hands:

1 Like

New version coming shortly, too. Added a feature to just make a list of numbers (with start at and increment values), so you can use it purely as an iterator or just to make a list of numbers if you so desire/need.

1 Like

Just published List Shifter version 1.4. This adds an option to construct a numeric list rather than having to use the ā€œOriginal Listā€ field. This is useful for those who want to use List Shifter purely as an iterator.

Additionally, thereā€™s a new GET INDEX Action that allows you to find the position of an item in the lists. You can optionally set the selected item to that item in one fell swoop.

Useful stuff!

As a reminder, if you dig List Shifter and get value from it, remember that it is Karma Wareā€¦ You can keep your Karma clear by contributing here:

4 Likes

Iā€™ve been wondering lately if one could construct a page that acts as a pseudo-API of sorts to host and perform perform these iterative actions via the page and then scrape the results. This would allow for server-side processing on data that is simply not possible right now now without using an insufferably slow recursive API workflow.

The issue Iā€™ve found, is that the bubble page rendering technique seems to resist scraping by even the most robust scraping toolsā€“at least in a default configuration.

Given how this tool is progressing towards a ā€˜pureā€™ data processor, Iā€™m wondering if anyone has given this serious thought?

Hey @jon2, these are interesting thoughts.

What youā€™re getting at is a concept thatā€™s more generally called FaaS (functions as a service). Iā€™d dissuade you from trying to make FaaS things in Bubble. Thatā€™s just not what itā€™s for. (Youā€™d be better off spending your time learning JavaScript ā€“ which is actually a joy to work with ā€“ and just doing the iterative things you need in your Bubble page (via a plugin or via the Run JavaScript and/or Expression plugins from Toolbox).

The above being said: I have thought about building a little ā€œsequencerā€ interface into List Shifter (or something like it) to get around the problems inherent in calling Bubble workflows in order to iterate.

This is a very deep problem and so Iā€™m going to apologize for not posting a very deep answer. However, you can do the following test in the latest version of List Shifter:

  1. create a 100,000 (one hundred thousand) length numeric list with list shifter.
  2. Create an iteration workflow. JUST do that. Do not put any actions in it.
  3. Fire that off with ā€œBegin Iterateā€

Even though there are NO ACTIONS in that workflow, youā€™ll see that the blue bar of death appears. (Why?)

Thereā€™s simply an appreciable amount of time that transpires between iterations. This is fine for 0-100 iterations, but it starts to become annoying for orders of magnitude greater than that. (And, really annoyance sets in at about iteration 40.)

What is Bubble doing? We donā€™t (cannot) know, unfortunately. We do know that itā€™s bothering to draw the wait state bar, but thatā€™s about it. (Why does it bother? We do not know.)

So I have thought about giving you a ā€œsequencerā€ of steps to execute on each iteration (bypassing the sending of an Event back up into Bubble).

But then, Iā€™m essentially bypassing Bubble and writing my own no code platform, with its own API (programming interface). So, Iā€™m not sure that I care, if you get my drift.

2 Likes

And here was I hoping I could use the plugin to iterate my over my over 100k list :woozy_face: and make an api call in each step.
I tried it yesterday and it actually froze the browser.
I knew it was a bad idea but just wanted to push it to its limit to see.

But for a small list of about 10 to 20 the iterator really works amazingly.

I guess bubble didnā€™t implement this know people might want to run it on huge lists.

1 Like

I have a basic working knowledge of JS. The issue Iā€™m encountering is querying the bubble Db server-side during an API workflow. Running more complex iterative queries on the db requires launching a recursive workflow. For example, right now on my page I use a repeating group setup as a calendar to calculate my projected inventory on hand for the next month.
This works fine and is fast (<5 seconds) to load the repeating group. The repeating group is able to take my dynamic query (which is somewhat complex given my specific db architecture) and loops through it quickly for all visible days. I can visually scan through and see what the inventory is for each day.

The problem
There is simply no built-in equivalent method Iā€™ve found to do the above server side without having to launch a separate workflow for each day to calculate the inventory. (365 workflows per year). My end-goal is to run my inventory counting query on a schedule (say twice a day) and to setup email alerts when a low inventory number is found on a given day. On the page, this takes seconds and can be done in a standard bubble dynamic expressing. Doing it as a recursive workflow takes 10 minutes and uses nearly all of my server capacity during that time.

Iā€™m wondering if there is a way to get the computational power of a page repeating group while server side without having to launch 365 API workflows and the large overhead that requires.

HEY @seanhoots: Funny you should mention this as I was thinking about doing a video on this. There is a client-dependent limit to how many items List Shifter can deal with.

This limit is orders of magnitude larger than for repeating groups (which of course can create many many DOM elements and hence can get very heavy on the client). RGs are OK to about 100 items, but can become very performance limiting at this level.

Depending on the client, LS can handle about 100,000 item lists before the browser falls over. On my very well specced development machine (with 32 Gigs RAM) Windows Chrome will handle up to 100,000 items and can operate on them without issue.

Again, oneā€™s mileage will vary, depending on client-side (browser) resourcesā€¦

In the case of List Shifter, what happens is that the call stack limit can get exceeded. And (while Iā€™ve not played around with this deeply yet) this may be because I coded List Shifter entirely with array type operations rather than literal loops. I avoid loops in favor of more modern iterable expressionsā€¦

But it turns out that some of these place undue restrictions on the client.

Working on some enhancements that may make List Shifter essentially unlimited in terms of what it can doā€¦

2 Likes