Hello everybody. I need your help for a project that I’m developing solo and I’ve reached an obstacle:
is a product register, each product has a list of ingredients that make it up, their quantities and their values… My problem is: When the list of values has two equal values, they are unified into an index, why does this happen?
It’s kind of difficult to explain, but I need a list of values, you know? But I don’t know how I do it, this explanation was just what I managed to do on my own
@P_Victor! Why don’t you create the table, for example tb_produto - frango, preco 10. Why do I say this? Because chicken is just one, there’s no need to mark it as a list [for prices], unless you’re going to separate free-range chicken, frozen chicken, then they’re different values, but it’s still a price for each product, removing their items, which could then be a list of things for the chicken. Is this result of yours supposed to appear as? in a repeating group through a filter? The person searches for chicken and the list of products registered as chicken comes up in alphabetical order, something like that?
About my intention: It’s a product creation pop, the user creates a name and adds a list of ingredients that make up this product; There is already an ingredients table that has fields such as kilo cost and unit price.
The value that appears next to the ingredient in the repeating group is to know how much of each ingredient is needed to make the recipe, then calculate the price. Is the reason for the list clearer?
Could you show me, in text format, what your database structure is? For example: I have two tables: a product table and an ingredients table. Could you send me the structure?
Hello, @P_Victor! Let’s start from the beginning, I don’t understand your objective, this is a recipe book, for example: Recipe for Salpicão (this is the product) and the ingredients are: shredded chicken, grated carrots, mayonnaise and raisins. The price of this product is $25.00. Is that your objective? Or are you looking for the user to put together a recipe and have individual values for each item? If you could explain, I would appreciate it.
Yes, that! The user will create the recipe for the product, following your example: To make Salpicão you need 200 grams of chicken costing R$5 and 100 grams of grated carrot costing R$5 as well… Therefore, the cost of the recipe for the Salpicão product It’s R$10
To do this, I thought about creating a repeating group to represent the list and calculate the value of the quantity of each ingredient to add to the recipe cost.