Hey,
I am working on a database that will be used for declaration on products (food and stuff).
Following tables are of interest
- a table containing different ingredients (IDIngredient, Name, values such as energy, fat, protein, carbohydrats, purchase price)
- a table containing different products (IDArticle, Name,...)
- a table containing recipies (IDArticle, IDIngredient, Amount)
- a table that gives the ingredientlist per IDArticle
My challenge is that some (not all) of the products that the database calculates values for, (such as cost to produce, fat/energy/protein/carbohydrats per 100 gram) are used as ingredients in other products.... so the IDArticle ends up with being an IDIngredient in another recipie so to speak.
I am not sure what to do and would appreciate a hint or advice on what to go for, before I dig myself into a too big hole. I can always feel my way onwards.
(Just to give an idea) I have made a form (please see attached picture) where the user can put together the recipie and other types of information such as allergens etc. The user should be able to look up all the necessary ingredients here, including those IDArticles/IDAingredients. Once the user selects an ingredient, necessary information is written into the recipie table (and other relevant tables).
(My thinking so far) I guess first step would be a "check-box" so that the database can be able to identify which articles the user should be able to use as an ingredient.
Maybe the best would be a macro that writes those articles into the ingredienttable ? How to avoid double entries? The name on the article could change (user error) between macro updates, pluss IDArticle and IDIngredient can't be the same for those products. Maybe a new column in article table with autonumber. For each new "checked" article, the column gives a number, which is either written into ingredient table if it is a new record, or used as lookup function if it already exists...?
In worst case, the user would have to manually enter the product as an ingredient in the ingredienttable , but the calculated values should be dynamic, including the ingredientlist. ... so it would be really nice if there is a solution to it.
Any help is very much appreciated.
Best,
Martin
I am working on a database that will be used for declaration on products (food and stuff).
Following tables are of interest
- a table containing different ingredients (IDIngredient, Name, values such as energy, fat, protein, carbohydrats, purchase price)
- a table containing different products (IDArticle, Name,...)
- a table containing recipies (IDArticle, IDIngredient, Amount)
- a table that gives the ingredientlist per IDArticle
My challenge is that some (not all) of the products that the database calculates values for, (such as cost to produce, fat/energy/protein/carbohydrats per 100 gram) are used as ingredients in other products.... so the IDArticle ends up with being an IDIngredient in another recipie so to speak.
I am not sure what to do and would appreciate a hint or advice on what to go for, before I dig myself into a too big hole. I can always feel my way onwards.
(Just to give an idea) I have made a form (please see attached picture) where the user can put together the recipie and other types of information such as allergens etc. The user should be able to look up all the necessary ingredients here, including those IDArticles/IDAingredients. Once the user selects an ingredient, necessary information is written into the recipie table (and other relevant tables).
(My thinking so far) I guess first step would be a "check-box" so that the database can be able to identify which articles the user should be able to use as an ingredient.
Maybe the best would be a macro that writes those articles into the ingredienttable ? How to avoid double entries? The name on the article could change (user error) between macro updates, pluss IDArticle and IDIngredient can't be the same for those products. Maybe a new column in article table with autonumber. For each new "checked" article, the column gives a number, which is either written into ingredient table if it is a new record, or used as lookup function if it already exists...?
In worst case, the user would have to manually enter the product as an ingredient in the ingredienttable , but the calculated values should be dynamic, including the ingredientlist. ... so it would be really nice if there is a solution to it.
Any help is very much appreciated.
Best,
Martin
Comment