InUniqueKey: Boolean;
The InUniqueKey property determines whether key binding is used.
Available values:
True. Key binding is used in MDM dictionary import. The Key attribute binding setting is not required.
False. Key binding is not used on MDM dictionary import.
The property is used to set up import of MDM dictionaries.
Executing the example requires that the repository contains a table with the T_BINDING identifier and a folder with the F_RDS_BINDING identifier. The table should contain the NAME and EDUCATION string fields.
Add links to the Dal, Db, Metabase, Rds system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
RdsLoader: IMetaRdsLoader;
Bindings: IRdsLoaderBindings;
PredBinding: IRdsPredefinedBinding;
Binding: IRdsUserAttributeBinding;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Create an object to create an MDM dictionary and load data to it
RdsLoader := New MetaRdsLoader.Create;
// Determine table which is a data source
RdsLoader.TableSource := MB.ItemById("T_BINDING").Bind As ITable;
// Set bindings for table fields and created dictionary
Bindings := RdsLoader.Bindings;
// Determine the Name attribute binding
PredBinding := Bindings.NameBinding;
PredBinding.Field := "NAME";
// Determine that key binding is used
PredBinding.InUniqueKey := True;
// Add binding for custom attribute
Binding := Bindings.Add(RdsLoaderBindingType.UserAttribute) As IRdsUserAttributeBinding;
Binding.Field := "EDUCATION";
// Determine that attribute created in the MDM dictionary will have the Long Text type
Binding.DataDomain := DbDataDomain.Memo;
// Determine information about created dictionary
CrInfo := MB.CreateCreateInfo;
CrInfo.Parent := MB.ItemById("F_RDS_BINDING");
CrInfo.Id := MB.GenerateId("DICT", 0);
// Determine data base used to create MDM dictionary
RdsLoader.Database := RdsLoader.TableSource.Database;
// Create a dictionary
(RdsLoader.CreateObject(CrInfo) As IMetabaseObject).Save;
// Load data
RdsLoader.Load(UpdateLoadMode.Insert);
End Sub UserProc;
After executing the example, a dictionary with the DICT identifier that is used to load data from the T_BINDING table is created in the specified folder.
See also: