Default Value Algorithms
Use the default value algorithms to set the default values for the attributes identified in the AttrValue element or in the VarDef element.
Out of the box, Windchill provides the following default value algorithms (names are shown on multiple lines in the table; enter the name of the algorithm on one line):
Algorithm
Description
com.ptc.core.foundation.folder.server.impl.
FolderPathAttributeAlgorithm
Converts the specified folder path string into a folder object reference. The most common use for this algorithm is to set the value of the folder.id attribute as shown in Default Folder Path Example using the FolderPathAttributeAlgorithm.
com.ptc.core.foundation.lifecycle.server.impl.
LifeCycleTemplateAttributeAlgorithm
Converts the specified life cycle name into a life cycle template object reference. The most common use for this algorithm is to set the value of the lifeCycle.id attribute as shown in Default Life Cycle Example using the LifeCycleTemplateAttributeAlgorithm.
com.ptc.core.foundation.team.server.impl.
TeamTemplateAttributeAlgorithm
Converts the specified team template name into a team template object reference. The most common use for this algorithm is to set the value of the teamTemplate.id attribute as shown in Default Team Template Example using the TeamTemplateAttributeAlgorithm.
com.ptc.windchill.enterprise.org.server.impl.
OwningOrgDefaultAlgorithm
Returns the organization participant (WTOrganization) of the context in which the object is being created. The most common use for this algorithm is to set the value of the organization.id attribute.
Use this algorithm to set the default owning organization participant of an object to the organization participant associated with the application context in which the object is being created.
For more information, see Owning Organization Participants.
com.ptc.windchill.enterprise.org.server.impl.
UserSuppliedOrgDefaultAlgorithm
Returns the organization participant (WTOrganization) that is identified through the value supplied as the argument for the algorithm. The most common use for this algorithm is to set the value of the organization.id attribute.
You can use this algorithm to set the default owning organization participant of an object to an organization participant that is not the organization participant associated with the application context in which the object is being created. For example use it to set the default to a specific supplier (or vendor) organization participant.
* 
To use this algorithm, Organization ID Type and Organization ID must be set as attributes on the organization participant that you want to use as the default owning organization participant. You can set these attributes using the Participant Administration utility.
The argument for this algorithm must be a string that has the following format:
<ICD_number>$<org_ID>
where: <ICD_number> is the international code designator number assigned to the organization ID type. For example, the default organization ID types use the following ICD numbers:
The CAGE ICD number is 0141.
The DUNS ICD number is 0060.
The ISO6523 ICD number is 0026.
<org_ID> is the organization identification number assigned when the organization was registered.
For additional information about the organization ID and the required format for this algorithm, see Creating and Updating Owning Organization Participants.
com.ptc.windchill.enterprise.revisionControlled.
server.impl.NumberGenerator
Returns a string that is generated according to the specified arguments. The most common use of this algorithm is to set the value of the number attribute (although, it can be used to initialize any string attribute).
Creating Numbering Scheme Rule Content has examples that use this algorithm.
com.ptc.core.foundation.vc.server.impl.
VersionInfoGenerator
Returns a version scheme with the specified name. The most common use of this algorithm is to set the value of the versionInfo attribute.
For an example, see Versioning Scheme Example.
wt.rule.algorithm.BooleanConstant
Parses a string argument as a Boolean. Returns true if the string argument is equal to the string "true" (ignoring case). Otherwise, returns false.
wt.rule.algorithm.StringConstant
Converts the specified value into a string.
wt.rule.algorithm.EnumTypeConstant
Converts the specified value into an enumerated value as shown in Document Attributes Example using the EnumTypeConstant.
wt.rule.algorithm.GetNullValue
Returns null. If an attribute is equal to null, then it has no value. There are no arguments to supply for this algorithm. This algorithm can be useful when you are specifying conditional logic inside a rule as well as setting an attribute to a null value.
wt.rule.algorithm.GetDefaultContent
Given the internal names of an object type and global attribute (as defined in the Type and Attribute Management utility), returns the default value of the global attribute. This is the default value that has been set using the Type and Attribute Management utility. If the object type or global attribute do not exist, the algorithm throws an exception.
Using Default Attribute Values along with a Generated Value shows an example using this algorithm in a numbering scheme.
wt.rule.algorithm.Substring
Given a string, a beginning index (beginIndex), and an ending index (endIndex), this algorithm returns a new string that is a substring of the original string. The substring begins at the specified beginning index and extends to the character at ending index - 1. Thus the length of the substring is endIndex – beginIndex.
Specify the arguments for this algorithm in this order:
1. A string representing the original string.
2. A string or integer representing the beginning index. The character at this index is the first character in the substring. If beginIndex is zero or less than zero, then the substring begins at the beginning of the original string.
3. A string or integer representing the ending index. The substring extends to the character at the endIndex - 1.
This argument is optional. If the endIndex is not supplied then the substring extends to the end of the original string.
If endIndex is less than zero or greater than the length of the string, the substring extends to the end of the original string.
A exception is thrown if either the type or the number of arguments that are required is incorrect.
wt.rule.algorithm.IndexOf
Given a string, a substring, and a starting index (fromIndex), this algorithm returns the index within the string of the first occurrence of the specified substring, starting at the specified starting index.
Specify the arguments for this algorithm in this order:
1. A string representing the initial string.
2. A string representing the substring for which you want to search.
3. A string or integer representing the starting index from which to search.
This argument is optional. If the fromIndex is not supplied, then the search starts at the beginning of the initial string.
If fromIndex is zero or less than zero, then the search starts at the beginning of the initial string.
If fromIndex is greater than the length of the string, then -1 is returned.
A exception is thrown if either the type or the number of required arguments is incorrect.
If the substring cannot be found, then -1 is returned.
wt.rule.algorithm.LastIndexOf
Given a string, a substring, and a starting index (fromIndex), this algorithm returns the index within the string of the last occurrence of the specified substring, searching backwards starting at the specified fromIndex.
Specify the arguments for this algorithm in the following order:
1. A string representing the initial string.
2. A string representing the substring for which you want to search.
3. A string or integer representing the starting index from which to search.
This argument is optional. If the fromIndex is not supplied, then the search starts at the end of the initial string.
If fromIndex is zero or less than zero, then the search starts at the end of the initial string.
If fromIndex is greater than the length of the string, then -1 is returned.
A exception is thrown if either the type or the number of arguments that are required is incorrect.
If the substring cannot be found, then -1 is returned.
Was this helpful?