Click or drag to resize

ScriptContextGetOrCreateField(String, FieldItemType) Method

Gets or creates the field matching both the given name and field data type.

Namespace: Compiled.EDD.Scripting
Assembly: Compiled.EDD.Scripting (in Compiled.EDD.Scripting.dll) Version: 9.0.0.0-142fa9725
Syntax
C#
public FieldItem GetOrCreateField(
	string fieldName,
	FieldItemType fieldType = FieldItemType.Text
)

Parameters

fieldName  String
The name of the field to create.
fieldType  FieldItemType  (Optional)
The data type of the field.

Return Value

FieldItem
The existing field if the field exists and matches the field type; otherwise, the newly created field.

Implements

IScriptContextGetOrCreateField(String, FieldItemType)
Exceptions
ExceptionCondition
ExceptionThrown when a matching field name exists but the data type does not match the field type.
Remarks
Calls GetField(String) to check if the field exists, then checks if the FieldItemType matches the existing field. When neither match, uses CreateField(String, FieldItemType) to create a new field instance.
See Also