We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

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

asked 2014-07-02 17:25:17 +0200

RHPV gravatar image

updated 2021-05-31 23:00:20 +0200

Alex Kemp gravatar image

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 on Ubuntu 12.04 LTS

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-27 12:13:24.126115


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.

RHPV gravatar imageRHPV ( 2014-07-02 18:02:46 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2014-07-03 01:08:31 +0200

frofa gravatar image

updated 2014-07-03 02:11:01 +0200

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.

edit flag offensive delete link more


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!

RHPV gravatar imageRHPV ( 2014-07-03 14:24:07 +0200 )edit

Question Tools



Asked: 2014-07-02 17:25:17 +0200

Seen: 1,204 times

Last updated: Jul 03 '14