Click or drag to resize

clsImportUserDefinedField Class

Creates a User Definied Field into selected tables of the MARIProject Database.

Please use first the GetListUserDefinedFields of each dimension to check if the User Definied Field is already created.

Inheritance Hierarchy
SystemObject
  MARIInterfaceclsImportBase
    MARIInterfaceclsImportUserDefinedField

Namespace:  MARIInterface
Assembly:  MARIInterface (in MARIInterface.dll) Version: 8.0.0.100
Syntax
public class clsImportUserDefinedField : clsImportBase

The clsImportUserDefinedField type exposes the following members.

Constructors
  NameDescription
Public methodclsImportUserDefinedField
Initializes a new instance of the clsImportUserDefinedField class
Top
Properties
  NameDescription
Public propertyClassID
Class ID for finding the correct table, where the field should be created.
[Mandatory Field]
Public propertyComboboxConnectionType
Combobox Connection Type.
Public propertyComboboxDataSource
Combobox Data Source.
Public propertyComboboxDataType
Combobox Data Type.
Public propertyComboboxUDF
Flag to set the user defined field as combobox field.
Public propertyDescription
MARIProject display name/ description
[Mandatory Field]
Public propertyFieldName
Database field name.
[Mandatory Field]. The field name must begin with "USER_"
Public propertyFieldSize
Database field size.
Public propertyFullTextIndexable
Flag for setting the full text search support.
Public propertySearchClass
Seach class ID (Link class ID)
Public propertyType
Field Type (INT, NVARCHAR...) of the field.
Public propertyUserDefinedFieldID
Import User Defined Field ID
Top
Remarks

The Mandatory Fields are:

  • ClassID
  • FieldName
  • Description
  • Type

Examples
Create a User Defined Field
public bool CreateUDF() {
    // Check if user defined field already exists
    MARIInterface.clsImportPhase oPhase = new MARIInterface.clsImportPhase();
    System.Collections.Generic.List<MARIInterface.clsImportUserDefinedFieldDefinition> oList = oPhase.GetListUserDefinedFields(oMPInterface);
    bool bFound = false;
    foreach (MARIInterface.clsImportUserDefinedFieldDefinition oField in oList) {
        if (oField.FieldName == "USER_UDF1") {
            bFound = true;
        }
    }
    if (!bFound) {
        // Create user defined field
        MARIInterface.clsImportUserDefinedField NewUDF = new MARIInterface.clsImportUserDefinedField();

        // Only possible for dimensions with user defined fields
        NewUDF.ClassID = MARIInterface.clsImportBase.eCoreDataClassID.Phase;
        NewUDF.FieldName = "USER_UDF1";
        NewUDF.Type = MARIInterface.clsImportUserDefinedField.eFieldType.Integer32Bit;
        NewUDF.Description = "User Defined Field 1";

        if (!oMPInterface.bImportUserDefinedField(NewUDF, MARIInterface.clsImportBase.eImportMode.ValidateAndImport)) {
            // oTimeKeepingLine.oErrors contains all Errors
            throw new Exception(oMPInterface.oErrors.PrintErrors());
        } else {
            return true;
        }
    }
    return false;
}
See Also