The Money, EmailAddress, and PhoneNumber Custom Types

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

When creating data entities using LightSwitch, you can add properties using several built-in custom types that are not found in most databases. These types include the Money, EmailAddress, and PhoneNumber types. Each of these types can be customized in various ways. For example, you can specify the currency symbol for a Money property and the format for a PhoneNumber property. In this topic, you will learn how you can customize these types:

The Money Type

To add a property to display a monetary value, select Money from the Type dropdown list of the Entity Designer.

To customize the Money property, first select the property in the Entity Designer. You can then specify the following properties unique to the Money type from the Properties window:

Property

Description

Currency Symbol

Enter the name of the locale for the currency. For example, if your currency is listed in United States Dollars, enter en-US here.

Decimal Digits

Enter the number of decimal digits to display. For example, enter 2 to display two digits after the decimal.

Is Formatted

Select this checkbox if you want to display the currency symbol, digit grouping separator, and custom decimal digits. Otherwise, do not select this checkbox. You can then decide which of these three items you want to display by modifying the Symbol Mode, Is Grouped, and Decimal Digits properties.

Is Grouped

Select this checkbox if you want to display a digit grouping separator. For example, if this checkbox is selected, a monetary value will display as 1,234.56 rather than 1234.56.

Symbol Mode

Select whether you want to display the currency symbol from this dropdown list. To display the currency symbol, either select Currency Symbol or ISO Currency Symbol. To not display the currency symbol, select No Currency Symbol.

The EmailAddress Type

To add a property to display an email address, select EmailAddress from the Type dropdown list of the Entity Designer.

To customize the EmailAddress property, first select the property in the Entity Designer. You can then specify the following properties unique to the EmailAddress type from the Properties window:

Property

Description

Default Email Domain

Enter the default email domain here. For example, if you have an Employees data entity and all employees have the same email domain, you can specify that email domain here.

Require Email Domain

Select this checkbox if the email address must have an email domain. Otherwise, deselect this checkbox. If you do not require an email domain, then you must specify a default value in the Default Email Domain textbox.

The PhoneNumber Type

To add a property to display a phone number, select PhoneNumber from the Type dropdown list of the Entity Designer.

To customize the PhoneNumber property, first select the property in the Entity Designer. You can then specify the following properties unique to the PhoneNumber type from the Properties window:

Property

Description

Phone Number Formats

When you click this link, the Phone Number Formats dialog box opens. Here you can specify how you want to validate and display phone numbers. You specify the format for the phone number using the letters C for country code, A for area or city code, and N for local number, and any symbols that are currently used to display phone numbers, such as +, -, (, ), ., and spaces. For example, to display a North American phone number, you could enter any of the following formats:

  1. C-AAA-NNN-NNNN

  2. AAA-NNN-NNNN

  3. (AAA) NNN-NNNN

  4. AAA.NNN.NNNN

When entering a phone number, it would first try to validate against the first format in the list. If the digits match the format, then the phone number would display in that manner. Otherwise, it would try to validate against the remaining formats in the list until a match is made.

See Also

Other Resources

Data and Entities: The Information Behind Your Application