Ask Your Question
1

Libreoffice Base - input mask and input conditions [closed]

asked 2013-01-16 08:02:16 +0100

hafron gravatar image

updated 2013-06-15 15:54:06 +0100

manj_k gravatar image

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

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 2015-10-20 00:49:33.914376

1 Answer

Sort by » oldest newest most voted
2

answered 2013-01-16 20:21:59 +0100

LiboV gravatar image

updated 2013-01-16 20:24:31 +0100

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 ...

(more)
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-01-16 08:02:16 +0100

Seen: 7,746 times

Last updated: Jan 16 '13