Get the Next Item from a Data Store Each Time it Runs?

Hello Make Community,

I am having some trouble with a scenario for an e-commerce store.

My Goal

My goal is to have a scenario that when triggered pulls from a database of prompts and chooses the next prompt on the list every time it runs. When it gets to the end of the list it should start again at the top (is this called autocycle?).

Once, a prompt is pulled from the database it then goes to the DALL-E 3 Module to generate an image. So, I want the scenario to create a different type of image based on the prompt from the database each time it is run.

To complete the scenario:

  • I use GPT-4 Vision to look at the image and give it a product name.
  • Then I resize the image using Mallabe module
  • Next is the router which sends the resized image and the product name to three different routes
  • Each route is a different apparel product shirt, shorts, and sneakers
  • Each route uses the product name and the resized image to write a product description, then uploads the image, product name, and product description to Printify

What I Have Tried

I am using the Data Store [get a record] module to get the prompt from the data store. The piece I am missing is how to get the scenario to move down the list of prompts each time it runs.

I have tried the iterator module, the Data Store [search record] module, and the increment function. I am not sure which modules to use or which order to use them in.

Please Help!

I have searched the forum to no avail, I think because I am not using the right search terms. So, I thought I’d ask for help.

Screenshots of Scenario Setup

Here is my scenario

My DB (more prompts will be added)

My Module Configurations

image

Thanks in advance for your help. It is much appreciated.

Best,
Ryan

Has anyone had a scenario go to the next item on a list or db every time the scenario runs?

If you have your scenario working fine now,

Then, I think all you need to do is insert a “last used” date column into your data store, so that in the data store trigger module, you can filter results to get the oldest used (or unused) item.

Then, immediately after getting your data store result, you just have to set the “used” date for the current item to {{now}}

2 Likes

Hi,

Thanks for the help.

How to set the “used” date for the current item to {{now}}?

Use the “Update a record” module.

2 Likes

I got it so it updates the last used date for the prompt.

One problem I think I see is that it’s using the key value to call the record and that is hard coded. So, it’s going to pull in the same prompt and keep updating the timestamp unless that key value is a variable too? Does that sound right?

I was trying to set up a filter so that it would not give me the most current. But even there the key value is hard coded.

And how would this work when I have ten items or more in the database?

Here’s where I am at

image
image

How would I get the scenario to advance to the next row each time it ran if the database was in a spreadsheet?

Thank you

No, you map the searched item’s key into that Key field, so it will know which item/row to update.

Take a look at my screenshot again.

You don’t use a scenario filter for this. Doesn’t the Data Store “Search Records” module already have a filter option built-in? BUT, you don’t even need a filter – see below

You don’t tell it to “advance” – that’s the beauty of it.

You just tell it to get the oldest item.

Screenshot_2024-01-30_100124

Brilliant. I am so happy. Thank you.

No problem, glad I could help!

1. If you have a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

others can save time when catching up with the latest activity here, and

  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

2 Likes