Libreoffice Base - input mask and input conditions

Hi,
is it possible to create an input mask to a database table filed in Libreoffice? I want to achieve something like this: 1 upper leter, 1 lower letter, max 3 numbers. For example:
Av456 Bj4 Nh34

Can I validate fields when I’m inserting them to table:
For example: I want to have date < today or I want to have int value between 20 and 120

Yes.

To start, int value input controls - use “Formatted Field” or “Numeric Field” controls, both have properties for Min and Max values. This controls what the user can input in the Form, but not in a Table view window. Depending on the database backend used you can also set this type of check at the databse engine. I’ll leave that alone here.

Date fields offer similar options or use the Pattern Field.

For the example above, in a form you will need to use a “Pattern Field” control vs a text field.

So, lets say you created your form with the wizard and it added text field controls with the form opened in design mode you select the control, right mouse click and select “Pattern Field”. Now when you open the property manager for the control you will find two new properties, “Edit Mask” and “Literal Mask”, these work together allowing you to limit the acceptable input pattern.

The Edit Mask would be “aANNN” and the Literal Mask wold be blank. Additionally you would use the Max Text Length property, set to 5 and the property Enforce Strict, set to TRUE.

Below I’ve included the old help information for the different mask characters.

Edit mask

By specifying the character code in
pattern fields, you can determine what
the user can enter in the pattern
field. The length of the edit mask
determines the number of the possible
input positions. If the user enters
characters that do not correspond to
the edit mask, the input is rejected
when the user leaves the field. You
can enter the following characters to
define the edit mask: Character
Meaning L

A text constant. This position cannot
be edited. The character is displayed
at the corresponding position of the
Literal Mask.

a

The characters a-z and A-Z can be
entered. Capital characters are not
converted to lowercase characters.

A

The characters A-Z can be entered. If
a lowercase letter is entered, it is
automatically converted to a capital
letter

c

The characters a-z, A-Z, and 0-9 can
be entered. Capital characters are not
converted to lowercase characters.

C

The characters A-Z and 0-9 can be
entered. If a lowercase letter is
entered, it is automatically converted
to a capital letter

N

Only the characters 0-9 can be
entered.

x

All printable characters can be
entered.

X

All printable characters can be
entered. If a lowercase letter is
used, it is automatically converted to
a capital letter.

For the literal mask “..2000”, for
example, define the “NNLNNLLLLL” edit
mask so that the user can only enter
four digits when entering a date.

b]Strict format[/b] You can have a
format check with control fields that
accept formatted contents (date, time,
and so on). If the strict format
function is activated (Yes), only the
allowed characters are accepted. For
example, in a date field, only numbers
or date delimiters are accepted; all
alphabet entries typed with your
keyboard are ignored.

1 Like