The ID Element property is the blueprint for your custom Workplace ID. It is a string that utilizes XML markup to build the ID.
To begin constructing the property, the XML string will need a parent node of IDFormat. The IDFormat parent node will contain one or more child nodes IDElement that will make up the individual pieces of the ID. There are four different types of IDElements that can be used to construct your custom ID. To specify the element type, the IDElement node requires a type attribute with one of the four elements provided.
• IDElement Syntax – When an IDElement contains text in the middle, such as with the text or date elements, there is an opening and closing part of each node set as <IDElement>xxx</IDElement>. However, when there is no additional “middle” content such as with ID, AlphaCounter, DayOfYear, ListID, SiteID, the syntax is just one part such as <IDElement type=”xxx” />. The “/>” closes the node.
• Attribute Names ARE Case Sensitive – The attribute names, such as padding, padChar, and pad are case sensitive.
• Padding - When using padding, it takes into account the total number of characters in the element. For instance, if you say padding=”5” this means that you are saying that the string should have 5 characters. If it has 4 characters, then it will pad with 1 character. If it has 5 or more characters, it will not pad.
Represents the auto increment portion of the ID to increment alphabetically from A to Z, then on to AA, AB, to AZ, and then to ZZ. From there, additional digits are added, starting with A. The DailyReset attribute can be used to reset the counter to A for each day.
• DailyReset (attribute, optional) – Resets the counter back to A each day. If this attribute is not used, it will continue to build out the alpha counter.
Example: <IDElement type="AlphaCounter" resetDailyCounter="true" />
Sample Output: AAA,AAB,AAC
A date element can be used to specify a date or any portion of a date when the record is created to be used as part of the ID.
Example: <IDElement type="date">MMMddyyyy</IDElement>
Please see the following page for more information on datetime format specifiers: http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx . Note that the datetime format specifiers provide functional differences and are not merely masks for content. For instance, in reference to the use of month syntax, there are four format specifiers as follows. The result differs.
M |
The month, from 1 through 12 |
6/15/2009 1:45:30 PM -> 6 |
MM |
The month, from 01 through 12 |
6/15/2009 1:45:30 PM -> 06 |
MMM |
The abbreviated name of the month |
6/15/2009 1:45:30 PM -> Jun (en-US) 6/15/2009 1:45:30 PM -> Juin (fr-FR) 6/15/2009 1:45:30 PM -> Jun (zu-ZA) |
MMMM |
The full name of the month |
6/15/2009 1:45:30 PM -> June (en-US) 6/15/2009 1:45:30 PM -> Juni (da-DK) 6/15/2009 1:45:30 PM -> uJuni (zu-ZA) |
Used to enter a counter for the day of the year. The day number is a three-digit number from 1 to 366 (to include leap year). It runs from January 1 to December 31. The number is automatically padded to three digits so, for example, January 12 is 012.
Sample Output: 285
A field represents the value of another field within the list item. This value can be the field value in its entirety, or it can be a portion of the field value from either the beginning or end of the field value. For instance, say there is a field called Project that contains the names of projects. All of the project name or a portion can be picked up by the Workplace ID.
• To specify the internal name of the field, provide an attribute internal and set its value = true. Otherwise, the display name will be used by default.
• To use only a portion of the field, you can provide the start attribute and set it value = true along with the chars attribute, setting it equal to the number of characters to display (e.g., start= true chars =3 will return the first 3 characters in the field).
• Setting the start attribute = false will do the opposite and pull the content from the end of the value.
• To return the content back as uppercase, provide the upper attribute and set it equal to true.
• To return the content back as lowercase, provide the lower attribute and set it equal to true.
Example: <IDElement type="field" internal="true" chars="3" start="true">FieldName</IDElement>
The following is an example of a Workplace ID that consists of the first three characters of a field called Manufacturer, followed by the month and day, and then the ID number.
Combined Example: ACM0509250XX (for a record with a Manufacturer named ACME, Inc. that was created on May 15, 2009, as record 250)
<IDElement type="field" chars="3" start="true">Manufacturer</IDElement>
<IDElement type="date">MMdd</IDElement>
<IDElement type="id" padding=”5” padChar=”X” pad=”right”>
NOTE: When working with field values, the Workplace ID will treat a blank space as a character – it does not strip the blank out of the string.
The number of characters to pad the element with. Padding characters will be added to reach that number. When working with field values, you may want to pad them to provide a consistent length, so that if a value is short it will have the same character length which is easier to read.
The character to pad the element with.
Controls which side of the element to pad, right or left. If omitted, the default is left.
start (attribute, optional)
Controls whether the text is captured from the beginning or end of the field.
upper (attribute, optional)
Controls whether the text will be saved in upper case.
Example:
<IDFormat><IDElement type="id" padding="5" pad="left" padChar="0" /></IDFormat>
This element type represents the auto increment portion of the ID. It increments by 1.
Example: <IDElement type="id"/>
This is the most basic syntax. Padding is usually used to specify a consistent number of digits. This makes the ID easier to read and will put items in a proper sort order when viewed in a display.
The minimum number of characters for the element. Padding characters will be added to reach that number.
The character to pad the element with. There is no default padChar. This is required for the padding to take effect.
Controls which side of the element to pad, right or left. If omitted, the default is left.
Example:
<IDFormat><IDElement type="id" padding="5" pad="left" padChar="0" /></IDFormat>
Returns the GUID for the list. The GUID is unique across a SharePoint farm, so using this element along with just the type=”id” will provide a unique ID across the farm.
Example: <IDElement type="ListID" />
The following is an example of an ID that consists of the first three characters of a field called Manufacturer, followed by the month and day and then the ID number.
<IDFormat>
<IDElement type="field" chars="3" start="true">Manufacturer</IDElement>
<IDElement type="date">MMdd</IDElement>
<IDElement type="id"></IDElement>
</IDFormat>
The ID of the current site that the list belongs to. This is unique for the site across the server farm, so combining this element with unique static text for each list or library in a site, and a type=”id” will also provide a unique ID across the server farm.
Example: <IDElement type="ListID" />
Use this element to enter static text that can be specified within the ID. The text respects blank spaces.
Example: <IDElement type="text">Your Static Text</IDElement>
The minimum number of characters for the element. Padding characters will be added to reach this number.
The character to pad the element with.
Controls which side of the element to pad, right or left. If omitted, the default is left.
Example:
<IDFormat><IDElement type="id" padding="5" pad="left" padChar="0" />></IDFormat>
When setting up the Workplace ID, the key is the “ID Format” column as it contains the descriptions for the resulting ID. It uses elements that are called IDElements to ultimately build up the IDFormat field. In the example below, the result will be an ID with left on the left and support for five levels of numbers:
<IDFormat>
<IDElement type="text">XYZ</IDElement>
<IDElement type="id" padding="5" pad="left" padChar="0" />
</IDFormat>
The IDElement with a type of “text” places text
into the ID. The IDElement with a type of “id” is what is placed as
a number into the field. The padding value indicates how many numbers
should be displayed as the number part of the ID, while the padChar value is the
number or character used for padding (in this case, a zero). So, when you
take the above and paste it into the ID Format field of the Workplace ID, the
result looks like this: XYZ00001.
The starting
value of the ID can be altered by changing the value in the “Workplace ID Start
Number” field.