Loop Insert to table

My Hosting is Heroku, Server model is NodeJS, Database is Postgresql, I have two tables, player table and ticket table. Now Player table have a column named Tickets with data type of integer, what i want to do is depending on the number of the tickets in the player table it will insert a data on the ticket table for example player a have 6 ticket now it should be on the ticket table it will populate the first 6 with Player A name

how will I do that?

Hi, Defy. The easiest way to solve this task is to use a repeat nested in another repeat.

  1. First apply the repeat step to the player table. In the output fields, take the player's name and the number of tickets.
  2. Apply another repeat inside the first one, which will be based on the number of tickets field from the first repeat. It will be repeated as many times as the number specified in the field. In the output fields, take the player's name.
  3. Inside the second repeat, insert the step of inserting data base into the ticket table. To fill in the player name field, take the data from the player name field of the second repeat.
1 Like

It works now Thank you :grin:

1 Like

Iā€™m glad it worked out! :+1: