OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How do you use pattern fields in forms??????
Goto page 1, 2  Next
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
vreid47362
General User
General User


Joined: 16 Jul 2003
Posts: 33
Location: New Castle, Indiana, USA

PostPosted: Fri Dec 12, 2003 7:55 pm    Post subject: How do you use pattern fields in forms?????? Reply with quote

Hi,

I have some phone numbers in a database that I would like to format into the following format "(XXX) XXX-XXXX" I think that I need to use a pattern field, but the documentation in the OpenOffice.org help is absolutely no help to me. Can anyone help me?

Specifically, how do I do the following:

1. Create an output format that will show up when the data is displayed in the form. What are the codes I can use to create this mask? In MS Access this is called an input mask.

2. What settings in the form controls need to be edited?

3. What is an edit mask?

4. What is a literal mask?

Thanks for the information.

Vaughn L. Reid III
Back to top
View user's profile Send private message
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Sat Dec 13, 2003 7:12 pm    Post subject: Reply with quote

The only reference that I have found is in the developers guide.
Quote:
Pattern Field
The pattern field control com.sun.star.awt.UnoControlPatternField displays and enters a string according to a specified pattern. The entries that the user enters in the pattern field are defined in the EditMask property as a special character code. The length of the edit mask determines the number of the possible input positions. If a character is entered that does not correspond to the edit mask, the input is rejected. For example, in the edit mask "NNLNNLLLLL" the character L has the meaning of a text constant and the character N means that only the digits 0 to 9 can be entered. A complete list of valid characters can be found in the OpenOffice.org online help. The LiteralMask property contains the initial values that are displayed in the pattern field. The length of the literal mask should always correspond to the length of the edit mask. An example of a literal mask which fits to the above mentioned edit mask would be "__.__.2002". In this case, the user enters only 4 digits when entering a date.

oPatternFieldModel = oDialog.Model.PatternField1

oPatternFieldModel.EditMask = "NNLNNLLLLL"

oPatternFieldModel.LiteralMask = "__.__.2002"
This should allow you to do the phone numbers at least.
Editmask = "LNNNLLNNNLNNNN"
LiteralMask="(555) 123-4567"
If you are setting these up manually in design mode, the Control Properties to be editted are "Edit Mask" and "Literal Mask". The edit mask behaves like a validation rule and the literal mask prefills the control. Set strict formatting on.
I eventually found the detail for the editmask in the help by using Find "Mask"

Quote:
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.
Back to top
View user's profile Send private message
mmorse757
Newbie
Newbie


Joined: 12 Sep 2004
Posts: 1

PostPosted: Tue Sep 28, 2004 5:18 pm    Post subject: 'Masks' in a form file. Reply with quote

Vaughn,

Did the previous response to your post help you at all? I am also trying to find out
out to use the equivalent of MS Access 'mask' function. When I do a Google of
openoffice and masks, your post is the only relevent hit that comes up.

Have you figured anything out yet?

Michael
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
vreid47362
General User
General User


Joined: 16 Jul 2003
Posts: 33
Location: New Castle, Indiana, USA

PostPosted: Tue Sep 28, 2004 6:51 pm    Post subject: Help Reply with quote

Michael,

I haven't really been able to get masks to work. I'm still confused about edit masks vs. lliteral masks and the format examples that I've seen seem confusing. It doesn't seem to matter what I put in the mask fields, I either get an error or the mask gets ignored. Finally, I gave up on the idea and am just careful when I input data.

My other experience with masks is that the format example box on the table design menu doesn't seem to work. It seems, at least with mysql and dbase, that the mask that I set there gets ignored.

For example, I defined a date format example for a dbase table the other day as German with a 4 digit year, dd/mm/yyyy. When I actually entered data, it showed up in the data source beamer as mm/dd/yy.

I'd like to see some step-by-step help written in everyday language for OpenOffice users.

-Vaughn L. Reid III
Back to top
View user's profile Send private message
Paco
General User
General User


Joined: 18 Sep 2005
Posts: 26
Location: Valcourt, Québec, Canada

PostPosted: Fri Sep 08, 2006 10:36 am    Post subject: Reply with quote

I can't get a Phone number to work neither. I'm trying to get 999-999-9999 format; entering only 9999999999 in the form. I wish I could get the dash to magicaly appear... I have various setting, read on pretty much what I could find but still cannot get it to work.

Can someone help me (us)?
_________________
Ooo - Love it! Thanks Ooo team! Using v2 on Win
--------------------------------------------------------------
USINUM - Paco's area
Back to top
View user's profile Send private message Visit poster's website
DrewJensen
Super User
Super User


Joined: 06 Jul 2005
Posts: 2616
Location: Cumberland, MD

PostPosted: Fri Sep 08, 2006 12:55 pm    Post subject: Reply with quote

Hello Paco,

Not sure what to tell you. Right now I only have 2.0.4 RC1 installed and using this if i creat a pattern field with the following settings

Edit mask = NNNLNNNLNNNN
Literal mask = ___-___-____
Strict format = YES

Then I can enter 1234567890 [ENTER] it will format out to 123-456-7890
Back to top
View user's profile Send private message Send e-mail Visit poster's website
audionuma
OOo Enthusiast
OOo Enthusiast


Joined: 23 Feb 2006
Posts: 126
Location: France

PostPosted: Fri Sep 08, 2006 1:03 pm    Post subject: Reply with quote

Hello,
to format data in a form, you can use a ... formatted field control.
While in form edit mode, select the formatted field and righ-click to display the control properties and select first tab (general).
There's a 'format' property (not sure of the name, I'm using a french version of OOo) which will allow you to format data display.
You can either enter directly a format definition string in the property field or click on the '...' button which will open OOo format tool.
Example :
to display a phone number XXXXXXXXXX as (XXX)XXX-XXXX, the format string is :
Code:

"("000")"000"-"0000

hope it helps.
Manuel
Back to top
View user's profile Send private message
Paco
General User
General User


Joined: 18 Sep 2005
Posts: 26
Location: Valcourt, Québec, Canada

PostPosted: Fri Sep 08, 2006 2:35 pm    Post subject: Reply with quote

Drew,
I'm on 2.0.3 and I can't get it to work with your settings. It just Beep me... I'm customizing a form to enter data to a table... right?!

Manuel,
I'd prefer to use a pattern form for it to kind of format my input (as simple as possible) to something more like the standard (999-000-9999).

Thanks you both for your kind help.
_________________
Ooo - Love it! Thanks Ooo team! Using v2 on Win
--------------------------------------------------------------
USINUM - Paco's area
Back to top
View user's profile Send private message Visit poster's website
DiGro
Super User
Super User


Joined: 02 Jun 2004
Posts: 1208
Location: Hoorn NH, The Netherlands

PostPosted: Sat Sep 09, 2006 4:22 am    Post subject: Reply with quote

Paco

should look like this



If you want the parentheses before and after:
Enter L before the first and after the last N in the Edit mask box.
Also place them at the appropiate place in the Literal mask box (first character and last) and they will show up in your form

BTW: in the Literal box now stands : [space][space][space]-[space][space][space]-[space][space][space], which is
[space] representing a N from the Edit mask box and - representing a L from that box

Also make sure that the table of your DB accepts the non-numeric characters
_________________
DiGro

Windows 7 Home Premium and OOo 3.3 NL (Dutch)
Back to top
View user's profile Send private message
Paco
General User
General User


Joined: 18 Sep 2005
Posts: 26
Location: Valcourt, Québec, Canada

PostPosted: Sat Sep 09, 2006 7:48 am    Post subject: Reply with quote

DiGro,

Double checked all this; can't get it to work... keep on beeping me. The table field is 'text [VARCHAR]' with enought space to enter the phone number.

I must be missing something...? I really doubt, but I can't help myself wondering if the form style could have to do with this issue... I may try that.

Still, thanks! Keep ideas comming
_________________
Ooo - Love it! Thanks Ooo team! Using v2 on Win
--------------------------------------------------------------
USINUM - Paco's area
Back to top
View user's profile Send private message Visit poster's website
DiGro
Super User
Super User


Joined: 02 Jun 2004
Posts: 1208
Location: Hoorn NH, The Netherlands

PostPosted: Sat Sep 09, 2006 10:55 am    Post subject: Reply with quote

Just tried it on another DB.

You can only enter a number if you're cursor is on the first character(number) place.

Tabbing through the fields will set the cursor in this particular field spot on the Open parentheses, causing the systeem to beep around and around.

You will have to move the cursor one place to the right to avoid the opening (
Then you can enter the number, but only as many characters as you have set in the Edit mask, then it starts beeping again.

Checked the corresponding table also and it is putting all (123) 555-789 in the correct way in the table (showing the parenthesis and the hyphen)

btw: nice woodwork Wink
_________________
DiGro

Windows 7 Home Premium and OOo 3.3 NL (Dutch)
Back to top
View user's profile Send private message
Paco
General User
General User


Joined: 18 Sep 2005
Posts: 26
Location: Valcourt, Québec, Canada

PostPosted: Sat Sep 09, 2006 11:42 am    Post subject: Reply with quote

No, doesn't work for me. I don't have the parentheses; it's only ###-###-#### and I'd like to only type in ########## and the magic would do the formatting for me to the table.

It's sad I cannot upload the file as attachement...?
Would you mind sending me this last data base you just made for testing (PM me or make it available somewhere for a moment until I can download it)? I could have a look at it and may find something that I missed about all this. I promise I'll post the solution if only I can find it.

Thanks for working out this issue with me!
_________________
Ooo - Love it! Thanks Ooo team! Using v2 on Win
--------------------------------------------------------------
USINUM - Paco's area
Back to top
View user's profile Send private message Visit poster's website
Paco
General User
General User


Joined: 18 Sep 2005
Posts: 26
Location: Valcourt, Québec, Canada

PostPosted: Sun Sep 10, 2006 10:19 am    Post subject: Reply with quote

Thanks to Dick Groskamp (and Drew Jensen),

I think I'm on to something; I can get the pattern field to work as I wish but not in the table/grid like control arragement (4th step of the form wizard; middle choice). With other arragement, it work perfectly both as I enter data in the form and afterward, looking at the table content. I liked the grid/table arragement, but I can live with another one... just further modification to please me.

Maybe this control (look like format field too) doesn't work in grid/table like control arragement...? Is this a bug, a limitation, totaly normal but not documented...?

Thanks again for all help.
_________________
Ooo - Love it! Thanks Ooo team! Using v2 on Win
--------------------------------------------------------------
USINUM - Paco's area
Back to top
View user's profile Send private message Visit poster's website
DrewJensen
Super User
Super User


Joined: 06 Jul 2005
Posts: 2616
Location: Cumberland, MD

PostPosted: Sun Sep 10, 2006 11:07 am    Post subject: Reply with quote

Damn, I should have remembered...they say the memory is the first to go...or is that second.

This is an open issue with 2.0.3 (perhaps earlier).

Issue #68834


And the workaround is to turn STRICT formt off.

Drew
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DiGro
Super User
Super User


Joined: 02 Jun 2004
Posts: 1208
Location: Hoorn NH, The Netherlands

PostPosted: Sun Sep 10, 2006 11:22 am    Post subject: Reply with quote

I'm afraid DREW is right (again Laughing )

As Drew was posting Itried to adjust the columnheader to a pattern field and it failed to insert the data.

Then I saw Drew's message Embarassed bummer

DrewJensen wrote:

And the workaround is to turn STRICT format off.

That didn't work either.

Sorry, can't help you there Crying or Very sad
_________________
DiGro

Windows 7 Home Premium and OOo 3.3 NL (Dutch)


Last edited by DiGro on Sun Sep 10, 2006 11:33 am; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group