Ask Your Question
0

Base subform: How to create product recipe input form?

asked 2018-08-03 10:32:32 +0200

Omk gravatar image

I am quite new to databases. I am creating a products datbase, where I have a table for products and table of ingredients. Then I have third table for product recipes with the following fields:

ID ID_Product ID_Ingredient Amount_ingredient Unit_amount

I need to create a form, where I can select a product from a listbox. Then I would need to specify its ingredients and their quantities and the measurement unit of each ingredient. There may be 1-50 different ingredients for each product.

I don't understand how can I create such a form, where I can add ingredient lines. Is it possible to for instance have a button: "Add ingredient", clicking of which would add a new ingredient entry line? Or what is the best way to accomplish this?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2018-08-06 04:20:44 +0200

echo8hink gravatar image

Your problem seems similar to what I had with food recipes.

I put an example database up in LibreOffice Templates some time back. It may be of some help to you to download and study it. It uses tables to handle recipe ingredients, units of measure, quantity, etc.

It is available here-> MyRecipes

Download and unzip the files. Open the database in LO Base. NOTE: you don't have to run the macros to use it.

I hope it helps.

edit flag offensive delete link more

Comments

i've downloaded this but can't get it to work at all

shadow97 gravatar imageshadow97 ( 2020-05-31 15:50:06 +0200 )edit
1

answered 2018-08-03 15:53:55 +0200

Ratslinger gravatar image

Hello,

This is the basis of relational databases. Your Products table is primary and the recipes are linked via one of the fields in the record back to each product. The recipes can have any number of records linked back to the one product. This is a one-to-many (Product-to-recipe) relationship.

With that, you have on a form (external), a main form(internal) which is the Product and a sub form (recipes) which has a property to link associated records back to what is shown in the main form. However, you also state you want a listbox to select the product first. This can be done using table filtering. To accomplish this, here are some posts with links to information and sample Base files: display specific record in a form, and how to put a search box into a LO Base form.

Also, you should read the LO documentation which has many good examples and many details about forms and sub forms. The documentation is found here -> LibreOffice Base Handbook

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-08-03 10:32:32 +0200

Seen: 803 times

Last updated: Aug 06 '18