Creating multiple (a list of) default data entries in a Libreoffice Base form

Hi everyone,

I am a biologist and at the institute where we work we collect specimens in traps.
I created a relational database with a table that contains a primary key, the trap_id, the date the trap has been set, the date the trap is emptied, the number of specimens in the trap and additional comments. The trap_id is linked to other tables with information about the trap.

Most traps are usually set and emptied at the same date. So I want to create a form where I can set a default “set date” and “empty date” and then click a button which creates an entry for each individual trap in the table control with default entry for number of specimens and comments NULL.

So for example:
My trap_id’s are: trap1, trap2, trap3, … , trap80
I set default set date: 1-1-2015, empty date: 3-1-2015. Would give me a layout in a table control as the example in the calc file here.

I would then only need to type the number of specimens and in some cases a comment. This would make my data entry much faster.

In Calc it is quite easy: copy, paste the previously used names and use autofill for the dates. Then fill in number of specimens. But I really need that relational database so I prefer to enter the data in Base.

Is there anyway to do this in Base? I tried looking for the answer, but I could not find it. I found that using filters is a good solution to get close to what I want, but so far I have only seen examples that create 1 default entry at the time and not a list of entries.

Thanks in advance for any help you can give me!

kind regards,
rhpv

EDIT: I am using Libreoffice 3.5.7.2 on Ubuntu 12.04 LTS

An example I found that creates only 1 default entry at the time.
Unfortunately, all other examples I found are similar to this one. Only one entry.

Hello rhpv:

I think what you are talking about is a technique called RECORD CLONING. It can be done in one 3 different methods (each with pros and cons):

  1. With Macro (basic) code - see here.

  2. With a TRIGGER (SQL code) - but only if you upgrade your engine to HSQLDB v2.3.x and re-configure your DB to SPLIT mode.

  3. Using sub-forms with a filter table - also see here, and also THIS for a working example using this approach.

In your case new records are created with a default “set date” and “empty date”. By using one of these methods. If you really need to create a BATCH of new cloned records in a single operation, you could probably run some SQL with INSERT INTO… - e.g. here.

Thanks! This is what I needed. It might be a while before I get any of these solutions to work, but now I know where to start. Thanks again!