Class FieldDefinition
Represents a custom field that can be associated with a translation memory or a fields template and for which values (FieldValue) can be associated with translation units in a translation memory (see FieldValues). These field values can subsequently be used in filter expressions (see FilterExpression) when searching or updating translation units.
Inherited Members
Namespace: SdlSdl.LanguagePlatformTranslationMemoryApi
Assembly: Sdl.LanguagePlatform.TranslationMemoryApi.dll
Syntax
public class FieldDefinition : IField, INotifyPropertyChanged
Constructors
FieldDefinition()
Creates a new empty field definition.
Declaration
public FieldDefinition()
Remarks
In order to add the new field to a translation memory or fields template, add it to the corresponding fields collection (FieldDefinitions or FieldDefinitions) and save the translation memory or fields template to persist the change (Save() or Save())
FieldDefinition(Field)
Declaration
public FieldDefinition(Field field)
Parameters
Type | Name | Description |
---|---|---|
Field | field |
FieldDefinition(Field, bool)
Initializes a new instance of the FieldDefinition class.
Declaration
[Obsolete("Please use FieldDefinition(Field field) constructor ")]
public FieldDefinition(Field field, bool isReadOnly)
Parameters
Type | Name | Description |
---|---|---|
Field | field | The field. |
bool | isReadOnly | if set to |
FieldDefinition(string, FieldValueType)
Creates a new field definition with the specified name and value type.
Declaration
public FieldDefinition(string name, FieldValueType valueType)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the field. |
FieldValueType | valueType | The type of value this field can hold. |
Remarks
In order to add the new field to a translation memory or fields template, add it to the corresponding fields collection (FieldDefinitions or FieldDefinitions) and save the translation memory or fields template to persist the change (Save() or Save())
FieldDefinition(string, FieldValueType, string[])
Creates a new picklist field definition with the specified name and value type.
Declaration
public FieldDefinition(string name, FieldValueType valueType, string[] picklistItems)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the field. |
FieldValueType | valueType | The type of value this field can hold. This has to be SinglePicklist or MultiplePicklist. |
string | picklistItems | An array of picklist values. |
Remarks
In order to add the new field to a translation memory or fields template, add it to the corresponding fields collection (FieldDefinitions or FieldDefinitions) and save the translation memory or fields template to persist the change (Save() or Save())
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if |
Fields
MaximumNameLength
The maximum length of a field name.
Declaration
public static readonly int MaximumNameLength
Field Value
Type | Description |
---|---|
int |
MaximumTextFieldValueLength
The maximum length of a text field value.
Declaration
public static readonly int MaximumTextFieldValueLength
Field Value
Type | Description |
---|---|
int |
Properties
Id
Gets a unique Id for this field definition.
Declaration
public Guid Id { get; }
Property Value
Type | Description |
---|---|
Guid |
IsNewObject
Gets a value indicating whether this instance is new object.
Declaration
public bool IsNewObject { get; }
Property Value
Type | Description |
---|---|
bool |
|
IsPicklist
Gets a value indicating whether this instance is picklist.
Declaration
public bool IsPicklist { get; }
Property Value
Type | Description |
---|---|
bool |
|
Name
Gets or sets the name of the field.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
Note that you have to save the translation memory of the fields template to persist the change after setting this property, depending on whether the field belongs to a translation memory or a fields template.
PicklistItemNames
The names of all picklist items for this Field. This collection will be empty if this field is not a SinglePicklist or MultiplePicklist.
Declaration
public IList<string> PicklistItemNames { get; }
Property Value
Type | Description |
---|---|
IListstring |
PicklistItems
Gets the picklist items representing the possible values for the field, in case this field is of type SinglePicklist or MultiplePicklist.
Declaration
public PicklistItemDefinitionCollection PicklistItems { get; }
Property Value
Type | Description |
---|---|
PicklistItemDefinitionCollection |
Remarks
Note that you have to save the translation memory of the fields template to persist the change after adding or removing picklist items, depending on whether the field belongs to a translation memory or a fields template.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when trying to access this property for a field that is not of type SinglePicklist or MultiplePicklist. |
ValueType
Gets or sets the type of value that can be associated with this field.
Declaration
public FieldValueType ValueType { get; set; }
Property Value
Type | Description |
---|---|
FieldValueType |
Methods
Clone()
Creates a deep copy of this field definition.
Declaration
public FieldDefinition Clone()
Returns
Type | Description |
---|---|
FieldDefinition | A copy of this field definition. |
Remarks
The field definition returned
CreateValue()
Creates a FieldValue instance, with the same name and type as this field declaration.
Declaration
public FieldValue CreateValue()
Returns
Type | Description |
---|---|
FieldValue | A FieldValue instance which is compatible with this field declaration. |