SharePoint Integer and Numeric Field (Site Column) Types


One of the Field types available for defining Site Columns is Integer, another is Numeric. When you create a site column using the UI, you won’t see an option for creating a site column of type Integer.

However if you create a site column of type Integer and provision it into SharePoint using a feature, you won’t see it in the Site Columns gallery. Curious, if you then build a Content-Type using this Site Column and provision that into SharePoint, and say, create a list using this Content-Type, voila, at last you will see your “Integer” type Site Column.

It turns out that the base Integer field type is marked UserCreatable = FALSE in the fldtypes.xml file, which mean that you can’t create fields of this type using the UI, but they can still be included as part of a Content Type.

Ok so why might you want to create a field (Site Column) of type Integer. Lets say you want to create a Site Column to store 4 digit years.

e.g.      2009

Well the Numeric field type allows you to set the Decimals part to zero, so the UI won’t display 2009.0. Great, except that the UI will display the year value 2009 as 2,009 with embedded commas,  which as a year display format isn’t great. The Field element also has an attribute called COMMAS which is supposed to control whether to display values using commas.

But, this attribute seems to be ignored, even if you set this attribute to FALSE the value is still displayed using commas.

What to do? enter the Integer field type, it doesn’t suffer from this problem and as long as you only want to use it as part of a Content-Type it’ll work perfectly.

About these ads

About Phil Harding

SharePoint Consultant, Developer, Father, Husband and Climber.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 597 other followers

%d bloggers like this: