Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    System.Object
    FieldDefinition
    Implements
    IField
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.TranslationMemoryApi
    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, Boolean)

    Initializes a new instance of the FieldDefinition class.

    Declaration
    public FieldDefinition(Field field, bool isReadOnly)
    Parameters
    Type Name Description
    Field field

    The field.

    System.Boolean isReadOnly

    if set to true [is read only].

    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
    System.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
    System.String name

    The name of the field.

    FieldValueType valueType

    The type of value this field can hold. This has to be SinglePicklist or MultiplePicklist.

    System.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
    System.ArgumentException

    Thrown if valueType is not SinglePicklist or MultiplePicklist.

    Fields

    MaximumNameLength

    The maximum length of a field name.

    Declaration
    public static readonly int MaximumNameLength
    Field Value
    Type Description
    System.Int32

    MaximumTextFieldValueLength

    The maximum length of a text field value.

    Declaration
    public static readonly int MaximumTextFieldValueLength
    Field Value
    Type Description
    System.Int32

    Properties

    Id

    Gets a unique Id for this field definition.

    Declaration
    public Guid Id { get; }
    Property Value
    Type Description
    System.Guid

    IsNewObject

    Gets a value indicating whether this instance is new object.

    Declaration
    public bool IsNewObject { get; }
    Property Value
    Type Description
    System.Boolean

    true if this instance is new object; otherwise, false.

    IsPicklist

    Gets a value indicating whether this instance is picklist.

    Declaration
    public bool IsPicklist { get; }
    Property Value
    Type Description
    System.Boolean

    true if this instance is picklist; otherwise, false.

    Name

    Gets or sets the name of the field.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    System.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

    Declaration
    public IList<string> PicklistItemNames { get; }
    Property Value
    Type Description
    System.Collections.Generic.IList<System.String>

    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
    System.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.

    Implements

    IField
    System.ComponentModel.INotifyPropertyChanged

    On this page

    • Constructors
      • FieldDefinition()
      • FieldDefinition(Field, Boolean)
      • FieldDefinition(String, FieldValueType)
      • FieldDefinition(String, FieldValueType, String[])
    • Fields
      • MaximumNameLength
      • MaximumTextFieldValueLength
    • Properties
      • Id
      • IsNewObject
      • IsPicklist
      • Name
      • PicklistItemNames
      • PicklistItems
      • ValueType
    • Methods
      • Clone()
      • CreateValue()
    • Implements
    Back to top Generated by DocFX