Best way to compare/match data?

Hello!

I have a user table with a record of images containing a list of user-uploaded images.

I then have a product table with a record of title, sku, and (a list of)images that’s compiled from a list of imported data from an external API.

My user images are named as the same as the SKU of the individual products.
I want to match these images to their respective SKUs.

001.png should match with SKU001.
002.png should match with SKU002.
2135_5.png should match with SKU2135_5.

So on and so forth!

I have tried to modify the products:last item, where the product constraint is tied to the user, using: add images = do a search for user’s image’s filename:filtered, where filtered is set to the following:

image

However, contains results in a yes/no.
Instead I need it to select the actual file and upload that file.

ie, if the file contains the product’s SKU: upload 001.png!
not, if the file contains the product’s SKU: yes

What would be the best way to get this going? Thanks!

bump! :slight_smile:

UPDATE:

I have a little bit of an oddity on my hands.

I have several recursive workflows that effectively iterate through a list and assign values based on matching parameters.

For reference, I have a list of products and a list of images.

My logic is built so that if an image’s filename contains the SKU of the product, that the image would add to the product record.

The issue is that it only works for the very first item, but does not work for anything other than the first item.

I have slowed my workflows down to five seconds each, and in the scheduler you can see the images iterate so I know that it’s at least working that part correctly.

Attached is my logic for the first workflow, where the thing I’m changing is the first product, filtered by whether or not an image is present in this item’s image record.

My second image shows the workflows ‘sort’ and ‘sort-missing’.

I’ve discovered that when you iterate through a list and use the :minus item feature, that the list you pass through the workflow eventually becomes 0. So, when the list is 0 I pass in a NEW list (same records) to a new workflow (sort-missing) – just so it can run again. It does this, in essence, forever. It just basically juggles the same list over and over (until, in theory, all SKUs have images).

My main thought is that I’m not changing the right item. Perhaps I’m changing the right item, and maybe the filter isn’t working.

The first item that doesn’t have an image should be put at the front of this logic, but… I don’t think that’s happening.

Any thoughts? Thanks 🙂

I also recognize the redundancy with the ‘filtered’ and ‘converted to list’ (as it’s already a list). I can assure you whether or not that ‘converted to list’ exists that the outcome is the same.

image

Any big brains that know how to get this to work coincidentally perusing this forum?

Edit: I will incessantly bump until I get this solved, either asking for help or providing updates! Promise <3

1 Like

After a lot of troubleshooting I was able to discover that this data was correct, but my regex was incorrect. Apparently when you are using the Shopify API it not only imports a ghost item, but the regex I was using matched with the entire string after the comma. Apparently Shopify likes to include a whitespace after the comma, before the next string. I was able to use a regex expression that eliminated the white space.

Now, fortunately, the entire process works.

Beep bop boop, problem solved. I’m the best.

1 Like

I really cant figure it out. I have a similar case. Importing products, product_images and product_options into bubble, via one api call and separate inserts.

  1. API workflow - GET LIST and schedule 2, 3 and 4 on a list
  2. Insert product
  3. Insert image
  4. Insert option

and then i would like to make changes to a list of things, like

  1. insert image - make changes to product

-…

I tested several things, but i dont get the right solution. Is there anything universal or just easier? I mean i loove bubble for the frontend etc. but sometimes there is just these little things where you need a 10x workaround to just do a simply match or update them like you would do in sql. And i did that already in a few minutes even tho i cant code.

I caaaaaant do this. f******