LibreOffice Base "Syncing phone number format between table and form"

  1. I go to the Data View Table in LibreOffice Base.
  2. I select a phone number field which appears as (914) 381-0000 for example.
  3. When I try to change the last digit to a 1, I get this result 9143810001.
  4. I select the phone number column, right click and go to column format.
  5. This is the only option that’s available in the listing.

How do I get the full list back so I can do a user defined format like (???) ###-0000?

Mike

User defined formats could only be set by numbers (decimal, integer …), dates and times. The only format for text is to write text.

You could use a form and use a masked field for this, but can’t get something like this directly for the table.

Where did you input a phone numer like

?

  1. I formatted the phone # in Excel>format column>special>telephone number.
  2. I opened the excel spread sheet in calc and copied the data.
  3. I pasted the data into a new table in base

I have created a form. How would I create as masked field for data entry of phone numbers like (381) 777-0000?

First have a look which datatype you are using for the column. Must be something like VARCHAR(20).

Seems the field is called “Pattern field” in English. Have a look here: Help - Edit mask.

Mask could be like this: (___) ___-____ and pattern will be LNNNLLNNNLNNNN
L: nothing could be changed
N: Only numbers are allowed.
But don’t know if a phone number contain always 10 numbers …

2 Likes

Thank you!!

So, I tried what you suggested and that works okay. Is there a way in which I should have imported the data from my Excel spreadsheet that would have allowed me to have this format, (914)381-0000, when entering phone numbers in table view?

Okay, I figured it out, I think. Now I can enter the phone number in either table view or the form as (910) 000-000 with the result being the same for both.

So you could set this one to “solved”.

Difference between textual phone “numbers” and numeric ones.

http://forum.openoffice.org/en/forum/download/file.php?id=13349

I created a pattern field in my form using (###") “###”-"0000 for the literal mask. I used the same format for the column format in data view. I chose “number” which shows up as -0 -1235, though I’m not sure why. Data entry in the table view and form are synchronized now as (000) 999-9999. Hopefully I did it correctly!

Nobody knows but you. The first thing that matters is the column type in the database table. Form controls are a secondary choice.
A pattern field is for text (column type VARCHAR). It can enforce that the user can enter digits only. What is stored to the column is a text including the entered digits and the preconfigured literals (braces, dash). It stores the literal text (000) 123-4567.

A formatted field is for numbers (column type BIGINT or DECIMAL). It can be formatted like a spreadsheet cell to display the integer number 1234567 as “(000) 123-4567”. What is stored is always a plain number such as 1234567.

2 Likes

Thanks @Villeroy, I will play with that and see how it works out.

As a test. .

I set a phone number column to column type Text VARCHAR. There doesn’t seem to be a way to enter the number as 1231233696 and have it displayed as (123) 123-3696 in the table column. Doing this in the form is easy by using a pattern field.

Last post not holding. .

This is working. . .Finally

  1. Set phone number fields as Numeric in table design
  2. Format table column as user defined (000)-000-0000
  3. Formula is pushed to numeric as (000")-“000”-"0000
  4. Set pattern field in the form to (000)-000-0000

I’ve been pulling my hair out over this “formatting choosing not to apply itself” nonsense for too long

Thank you.