Forum Academy Marketplace Showcase Pricing Features

How do I Create a Thing for each item in a list?

Part of my app presents the user with a set of Questions, and logs their Answer (creates an “Answer” thing with score, Question ID, User ID).

In the data model, a Question is tied to a List of Products (with Products being another first-class data type).
Example:
Question 1: “On a scale of 1-10, how much do you like playing outside?
–Q1’s List of Products in the db: skateboard, soccer ball, hoverboard, winter coat
User John provides Answer: 8

I want to take the Answer’s score (8), and create multiple new things (eg data type called Product Rating, with fields Product, rating, User ID) for each Question’s associated products. So, in the example above, If John answers Question 1, I’d end up with 4 rows in the Product Rating table:

  • Product=skateboard | Rating=8 | User=John

  • Product=soccer ball | Rating=8 | User=John

  • Product=hoverboard | Rating=8 | User=John

  • Product=winter coat | Rating=8 | User=John

The reason for the data structure is that a product may be associated with multiple Questions. For example, a Question like “How much do you like soccer?” may also include “soccer ball” in its List of Products, and the user may answer “5”, so down the line I intend to aggregate all the Product Ratings for soccer ball (8, 5) and generate an aggregate/average rating.

I won’t catalog all the stupid ways I’ve tried and failed to achieve even the first step of populating Product Ratings. Tried workflows w/ custom events, hidden groups on a page that populate as answers are supplied, etc. Have seen other similar questions where advice was to use a Scheduled API Workflow, but that seems overly complex for the use case. Could really use some guidance here! Relative newbie, great velocity building the app so far, but this is a brick wall stopping all further development.

Thanks in advance!

You will need to create an API workflow that creates a thing. And then schedule that workflow on the list.

It seems awkward at first but it is fairly simple in reality.

The only slightly tricky bit is working out what parameters to pass in, but you seem to have a good handle on your data.