View Full Version : Creating a Mask


08-13-2004, 02:19 PM
Using regular A5, you can create a mask and store just the data. Is the same thing possible using display format? I know there are some ways to format numbers with dollar signs, commas etc.

Basically I have a phone number 5555555555 that I would like to display as (555) 555-5555

Cheryl Lemire
08-13-2004, 02:43 PM
Hi Jim,

Where are you trying to display the format? You could use xbasic to break up your phone number field into three separate areas and then on your form/report/a5w page or where ever you plan on displaying this value have the ()- physically typed in the proper location. You could probably even do that in xbasic, but I have not tried it.


08-13-2004, 02:50 PM
I would like to display the format within a grid on an A5W page. I am doing it within the field properties on a grid field. Unfortunately I do not know anything about xbasic, so provided I can learn as I go thats fine. For instance, what would the code be, where would I place it in the xbasic and if I modify something else in the grid with the custome code be overwritten?

Selwyn Rabins
08-13-2004, 03:04 PM
New Page 2

you can use a display format of:
"(" + left("value",3) + ") " + substr("value",4,3) + "-" + substr("value",7,4)

and a displayUnformat setting of:

the displayUnformat will remove the formatting from the phone before saving
it to the database

Mario Prieto
08-31-2004, 10:16 PM
I think the easier way to do what you want is to use the mask() function.
Check it out on the Xbasic reference.

The Mexican

Selwyn Rabins
09-01-2004, 06:36 AM
Wow! thanks. I did not even know we had that function. you are right. using mask() and unmask() is much more elegant!