Forum Academy Marketplace Showcase Pricing Features

How can I use Merged With but keep duplicates?

This is causing me real issues suddenly.
I’m trying to display basic data in a repeating group but it comes from two separate DataTypes. For this reason I’m using a “Search for” ABC Merged With a “Search for” XYZ. The issue is that I need the duplicates to show but Merged With obviously eliminates them. Here’s a pictorial version of my problem. I’d love to know if there’s a way of achieving “MergedWith” data without eliminating
duplicates. I’ve searched the forum and elsewhere and I haven’t found an answer that doesn’t require Java which I don’t know anything about. I’d love there to be a way to achieve this aim. Perhaps I’m better off using separate repeating groups for our own items and 3rd party items and trying to squeeze them together so it looks like just one table but that gets untidy when someone only orders 3rd party items which leaves a space where the table above is empty.

Screen Shot 2022-07-07 at 16.55.20

You can concatenate two lists using the “SET Custom List” action in List Shifter.

(If you’re not familiar with List Shifter, the main thread for that is here.)

Here’s a very simple example where we concatenate the results of two searches together (which share some items in common) and preserve any duplicates:

There’s a link to the editor on that page so you can examine how it’s set up.

Here’s a post where I explain the different list outputs of List Shifter.

1 Like

Keith

Thank you. That sounds exactly like what I’m after. I’ll have a good look at it today. I installed LS a while ago but found a workaround without using it. It seems powerful and I’m hopeful of success now.

All the best
Joe

Keith, this is very cool. Thank you! I’ve achieved a “merged” list which includes my duplicates!

My only question (and I hope it’s a simple one but that’s the level I feel I’m at) is that a user can only generate the list when they click a button next to it but, ideally, list with duplicates needs to appear when the Page loads. If I use the “When Page Loads” event, I can’t see the ListShifter objects. Can you tell me how I can achieve this? Do I need to be playing with BackEnd Workflows?

Sorry to have a further question. I’m incredibly grateful to you for your help in getting me this far though.

All the best
Joe

1 Like

Hey @joefarrowsmith: Something important to know about List Shifter (and similar element plugins that have Actions) is that Actions can’t be fired at them before those elements are fully initialized on the page. And this happens after Bubble’s “Page Loaded” Event (very, very shortly after, but still after).

So, in List Shifter, we have an Event called “List Shifter Initialized/Updated”. This event fires:

  1. when the List Shifter is fully loaded in the page and its “List to Shift” and “Scalar” inputs have been retrieved and all outputs have been published (that is, as soon as List Shifter is “initialized”) and
  2. whenever the values in List to Shift or Scalar have changed (that is, whenever it is “updated”).

Further, there is an exposed state, “Initialized” which is a boolean (what Bubble calls a “yes/no”) that goes to true (“yes”) when List Shifter is fully initialized.

Examine the example project again, which I’ve modified to show how you might make use of these events. You’ll note that now, when the page loads, we see the values in LS 2’s custom list, without having to click the “Concatenate” button. (Though we can still Clear the custom list and click the button again to also trigger the concatenation.)

What I’ve done is moved the SET Custom List actions into their own Custom Event:

And then the Button workflow becomes:

And then we have two additional events for triggering the Concatenate event. “When LS1 Initialized/Updated” and “When LS2 Initialized/Updated”. Keep in mind that we do not know which List Shifter will be initialized first and additionally, we want both of them to be initialized before we do the concatenation. So they’re configured like this:

:point_up:this says, “When LS 1 gets initialized or its contents change, do the concatenation, but Only when LS 2 is also initialized.”

Similarly, we have the converse for LS 2:

:point_up:this says, “When LS 2 gets initialized or its contents change, do the concatenation, but Only when LS 1 is also initialized.”

Tiny pro-tip: For those “Only when…” conditions, we could have written LS 1's Initialized is yes and LS 2's Initialized is yes , but that’s redundant.

1 Like

Keith, this is so hugely valuable to me. Thank you. I really appreciate it. I will study it thoroughly over the weekend and will go over every word of it. I’m sure I’ll end up with a much better understanding.

I’m so enamoured with Bubble because of how far it’s enabled me to get with my app and it’s mostly people like you being so generous that have enabled it. I’m excited for next week where I will make the final breakthrough I need.

Thanks again and have a wonderful weekend.

All the best
Joe
(Currently in a pub in the UK so time zones and social etiquette prevent me from getting onto this right now!)

2 Likes

@keith I think I must be missing something because I can’t get ListShifter to work combining two lists. I’ve been stuck here all day, if you could take a quick look and help point me in the right direction I would be eternally grateful!

Related workflows are highlighted blue.