Como fazer cálculos com dados de uma tabela

Tenho duas tabelas exibindo dados, uma exibe escolas e quantidades de alunos e outra produtos e seus estoques. Como configurar um BP para distribuir produtos com base na quantidade de alunos. O usuário selecionará as linhas da tabela escola, com base nas linhas selecionadas tenho que extrair a quantidade de alunos que terão produtos distribuídos. Depois na tabela seguinte seleciono as linhas com quais os produtos que quero distribuir e em seguida devo fazer o cálculo de produtos por aluno. Já tenho as tabelas, os dados, só não consigo fazer a distribuição. Podem me ajudar?

Hey @Hudson_Melo
Welcome to the AppMaster Community!

It should be easy to archive what you want:

  • Get Selected rows from the table with BP blocks
  • Use student ID to create array of students IDs
  • Create BP to distribute products (assign?) to students in your backend, attach that BP to endpoint
  • Call your endpoint with students ids array, including products. Save result to another table.

Usually, the best way is to create pivot/intermediate table that will store your product transactions:
Student has_many Transactions has_many Products
In this case you will be able to track when you distribute and how many/what products.

If you will describe your algorithm in more details, our team members will assist you better.