Ask Your Question
0

I cannot set a Primary key after Importing Tables into LibreBase

asked 2019-05-13 17:19:23 +0200

Sums gravatar image

I copied and pasted Tables from Excel into LibreBase but there is no option to set a Primary key in the menu.

I was given an option of creating a Primary Key when Importing but LibreBase did not allow me to choose my own PK Field so I chose No.

How can I set a PK now?

Thanks for any help offered

edit retag flag offensive close merge delete

Comments

ebot gravatar imageebot ( 2019-05-14 11:22:04 +0200 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2019-05-13 18:41:31 +0200

Ratslinger gravatar image

updated 2019-05-14 00:38:13 +0200

Hello,

You have not posted any specifics which is important in answering the question - LO version, OS database being used.

Please see my answer in this post -> How can I load csv data to base?

Also, don't think you can copy & paste from Excel. Calc is OK.

Edit:

...why would Libre make this so difficult.

It is not.

As stated in the link in the answer above, the documentation shows this process. This was again noted in my first comment below. Here is a screen shot showing this same item:

image description\

Once you get to this section of the dialog (of course using the Next buttons) you would need to right mouse click on the field which you want to set as the primary key.

In the documentation, Chapter 3 Tables - Page 43

edit flag offensive delete link more

Comments

Apologies, I copied and pasted from Calc. Im using LibreOffice 6.2 and Windows 10

Sums gravatar imageSums ( 2019-05-13 19:11:19 +0200 )edit

The documentation does show where the primary key is applied in the process used. However, to actually change what you have already, what database are you using?

Note: v6.2 is still general; I am using v6.2.3.2 - sometimes makes a difference.

Ratslinger gravatar imageRatslinger ( 2019-05-13 19:16:00 +0200 )edit

Firebird database

Sums gravatar imageSums ( 2019-05-13 19:38:24 +0200 )edit

Firebird has a number of issues in this regard. With HSQLDB you can simply edit the table & set the Primary Key. With Firebird there are a number of errors to get around.

I would recommend to start over but differently. First create a new table definition and set all fields to needs. Then copy data data from Calc and use the append data setting to add the data to existing definition.

Ratslinger gravatar imageRatslinger ( 2019-05-13 19:53:49 +0200 )edit

I deleted the DB and created a new one using HSQLDB. I copied and pasted from Calc and did not a add a PK because the wizard said I could create a PK from existing fields in the Type Format window, however there was no option to do so. There is only an option to add a Unique Index when the table has been saved but no option to add a PK. The Pk is the most important part of any DB, why would Libre make this so difficult.

Sums gravatar imageSums ( 2019-05-14 00:14:34 +0200 )edit

Please see edit in my answer

Ratslinger gravatar imageRatslinger ( 2019-05-14 00:27:00 +0200 )edit

I don't see any edit

Sums gravatar imageSums ( 2019-05-14 00:33:00 +0200 )edit
0

answered 2019-05-14 09:50:44 +0200

Sums gravatar image

updated 2019-05-14 09:51:23 +0200

When you copy and paste a table from Calc into Base you do not have to create a new field to use as a PK field.

Instead you can assign a PK to a Field or Fields already in your Table following these steps: 1) Copy and Paste your Table from Calc into Base 2) Name your Table and click next 3) Choose the fields you want in your Table and click next 4) Right Click the Field that you want to set as the PK and choose PK

This should have been made clear by a simple note in the window. Instead Base has the PK option hidden which is not helpful.

edit flag offensive delete link more

Comments

This was made clear in the documentation.

Ratslinger gravatar imageRatslinger ( 2019-05-14 11:12:48 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-05-13 17:19:23 +0200

Seen: 40 times

Last updated: May 14