Class EditActionRenameField
Renames a field or a field's picklist values. System fields cannot be renamed. The subsequent processor needs to know how to handle renamed fields - i.e. an importer would need to be allowed to add new fields on-the-fly unless the TM is already set up. If fields or picklist values are renamed, in-place editing in a UI may fail unless the renamed objects are already defined in the TM's setup.
If a field is renamed but a value with that renamed field value already exists, the original field value will be dropped. Note that the field type will remain as is.
The action can also be used to rename picklist values. If the PicklistValueMap is non-null, then that mapping will be applied to the values of picklist fields. If you only want to rename the picklist values, but not the field itself, set ToName to the same value as FromName.
Inherited Members
Namespace: Sdl.LanguagePlatform.TranslationMemory.EditScripts
Assembly: Sdl.LanguagePlatform.TranslationMemory.dll
Syntax
public class EditActionRenameField : EditAction
Constructors
EditActionRenameField(String, String)
Initializes a new instance with the specified values.
Declaration
public EditActionRenameField(string fromName, string toName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fromName | The original field name |
| System.String | toName | The new field name |
Properties
FromName
Gets or sets the field name prior to the change.
Declaration
public string FromName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
PicklistValueMap
Gets or sets a picklist value name mapping for picklist values. This will only be applied to picklist fields.
Declaration
public Dictionary<string, string> PicklistValueMap { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.Dictionary<System.String, System.String> |
ToName
Gets or sets the new field name. Cannot be a reserved field name (i.e. a system field).
Declaration
public string ToName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Methods
Apply(TranslationUnit)
Declaration
public override bool Apply(TranslationUnit tu)
Parameters
| Type | Name | Description |
|---|---|---|
| TranslationUnit | tu | The TU to apply the edit action to |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Overrides
Validate(IFieldDefinitions, Boolean)
Declaration
public override bool Validate(IFieldDefinitions fields, bool throwIfInvalid)
Parameters
| Type | Name | Description |
|---|---|---|
| IFieldDefinitions | fields | The field definitions to validate against. |
| System.Boolean | throwIfInvalid | If true, an exception will be thrown if invalid field names or other issues are encountered. If false, the return value will be set to false without an exception being thrown. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|